Save as dialogue for field contents

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Preston Shea
Posts: 73
Joined: Sat Apr 08, 2006 6:51 pm

Save as dialogue for field contents

Post by Preston Shea » Fri Mar 13, 2009 8:05 pm

What is the "save as" equivalent of "ask file" for the user to save the contents of a field as a text file. and choose the location for the file?
In nova fert animus mutatas dicere formas corpora.

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Fri Mar 13, 2009 8:17 pm

Hi Preston

Something like:

Code: Select all

on exportText
  ask file "Name the export file:" with "ISaGo.txt"
  if it is empty then exit exportText
  put it into savedTextPath
 
    put field "FieldAll" into ResultList

  put ResultList into url ("file:" & savedTextPath)
end exportText
Would do the trick. HTH.

:)
Last edited by gyroscope on Sat Mar 14, 2009 12:02 am, edited 1 time in total.

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Fri Mar 13, 2009 11:22 pm

Yay, Jan, you've started a meme!

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Fri Mar 13, 2009 11:37 pm

Code: Select all

Yay, Jan, you've started a meme!
I borrowed Jan's meme! (Didn't meme to) :wink:

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Sat Mar 14, 2009 10:05 am

I did! I blatantly stole it.

Preston Shea
Posts: 73
Joined: Sat Apr 08, 2006 6:51 pm

Post by Preston Shea » Sat Mar 14, 2009 10:27 pm

I have no idea what a meme is, but thanks very much for the nice function to save a text field as a file.

How do I insert some text into the midst of a field of text? I know how to use the clickChunk to get the position where I want to insert text, but how do I move the rest of the text over (I don't want to replace it)?

Thanks again for all your help.
In nova fert animus mutatas dicere formas corpora.

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Sat Mar 14, 2009 11:26 pm

Preston Shea wrote:I have no idea what a meme is, but thanks very much for the nice function to save a text field as a file.

How do I insert some text into the midst of a field of text? I know how to use the clickChunk to get the position where I want to insert text, but how do I move the rest of the text over (I don't want to replace it)?

Thanks again for all your help.
Wikipedia will give a more technical definition, but for the simple purposes, a meme is:
  • An idea that, like a gene, can replicate and evolve.
    A unit of cultural information that represents a basic idea that can be transferred from one individual to another, and subjected to mutation, crossover and adaptation.
    A cultural unit (an idea or value or pattern of behavior) that is passed from one generation to another by nongenetic means (as by imitation); "memes are the cultural counterpart of genes".
Jan (Schenkel) is one of the icons on this forum and typically signs off his helpful contributions with "HTH" = "Hope That Helps".
I started to do the same (sometimes with a credit to Jan and acknowledgement that I'd "stolen" the signoff from him) and I was amused to see gyro do the same this time.

Anyway, if you're using the clickChunk you will find the char range that's selected. If you note the first char position of the clickChunk, you can replace that with the entire new text (and the original char in that position) thus:

Code: Select all

put word 2 of the clickChunk into theChar
put theNewText & char theChar of field "targetField" into char theChar of field "targetField"
This will replace the single char at the start of the clickChunk with the whole new text plus the original single char (so you may need to add spaces etc but this will give you an idea). There are lots of ways to tackle a cat-skinning project in Rev though.

Preston Shea
Posts: 73
Joined: Sat Apr 08, 2006 6:51 pm

Post by Preston Shea » Sun Mar 15, 2009 10:56 am

My thanks again for the meme explanation and clickChunk cat skinner. The latter is just what I need; the former an interesting concept that I want to think about some more. You have been most kind.
In nova fert animus mutatas dicere formas corpora.

Post Reply