How do you get the name of an open saved file in memory using message box?

Mike Bonner bonnmike at gmail.com
Sun Jun 13 09:48:48 CDT 2010


Ok, so the file is created or opened to start with. If its a
pre-existing file that is opened by using "answer file" as long as the
user doesn't cancel, the path to the chosen file will be in the "it"
special variable.
So if you put "it" into some place to store it, you then have the
filename.  YOU need to keep track of this until the file is closed so
that you can use the information.

If a new file is created and saved, again, as soon as its saved, you
know the filename. Store it as stated above for later use. Use "ask
file" to prompt the user for the initial save, then put "it" into a
storage vehicle.

Either way, at this point you as the programmer should be tracking the
file name.
So if you want to have a save as option, again use "ask file"

ask file "Save as" with "yourstoredfilepath"
See 'ask file with' in the dictionary for more information.

While looking at all this, you should also read the entry for
defaultFolder, specialFolderPath and the like as you are most likely
going to need them.


On Sun, Jun 13, 2010 at 7:01 AM, charles61 <cszasz at mac.com> wrote:
>
> Hi Sarah,
>
> The situation is the same as the user who has created and saved a document but then decides to make a change to the document before creating a new document. The dialog is essentially a Save As Dialog where the user is asked whether to save the document with the same name or disregard the changes and close the document.
>
> In my current dialog the user is given the standard save "untitled.txt" option. Instead, I would like the user to get a dialog that says Save the file "abc" or disregard the changes. Here "abc" is the name of the saved file before changes were made to the file.
>
>> Hi Sarah,
>>
>> The situation is the same as the user who has created and saved a document but then decides to make a change to the document before creating a new document. The dialog is a reminder to the user to save the document before closing it with the same name or with a different name. In other words, it is a Save As Dialog that you would see if you were closing a document but have not saved some changes to the document.
>
> Charles Szasz
> cszasz at mac.com
>
>
>
>
> On Jun 13, 2010, at 6:02 AM, Sarah Reichelt-2 [via Runtime Revolution] wrote:
>
>> > The question is how do you get the name of the file that is opened from a
>> > script to save in a variable. This is what I been unable to do.
>>
>> How do you open the file? Do you get the user to select a file using
>> the answer file dialog?
>> If so, try something like this:
>>
>> global gOpenDataFile
>> answer file "Select a file to open:"
>> if it is empty then exit to top
>> put it into gOpenDataFile
>> put URL ("file:" & gOpenDataFile) into tFileData
>> -- process the file data as usual
>>
>> Now the global variable gOpenDataFile contains the full path to the
>> data file that was opened.
>> You can use this later when asking to save:
>>
>> global gOpenDataFile
>> ask file "Save data file?" with gOpenDataFile
>>
>> And it will offer the same folder and file name as before.
>> Note that if you select the same file name, the OS will give you a
>> file exists warning, whereas if you just save directly using the file
>> name, then it won't.
>>
>> --
>> Cheers,
>> Sarah
>>
>> Rodeo discussion:
>> http://rodeoapps.com/rodeo-discuss-among-yourselves
>> _______________________________________________
>> use-revolution mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
>> View message @ http://runtime-revolution.278305.n4.nabble.com/How-do-you-get-the-name-of-an-open-saved-file-in-memory-using-message-box-tp2252969p2253331.html
>> To unsubscribe from Re: How do you get the name of an open saved file in memory using message box?, click here.
>>
>
>
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/How-do-you-get-the-name-of-an-open-saved-file-in-memory-using-message-box-tp2252969p2253404.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list