On Jun 14, 2010, at 10:38 AM, charles61 wrote:
Hi Sarah,
The user does not get the file by selecting ti. In this situation,
1. The user creates a new file and populates the file
2. Then saves the file "abc".
3. User decides to make a change in the file.
4. The user opens a new file without saving the changes to file abc.
This is where I want to get a dialog asking the User to save file
"abc" or disregard the last changes made and start a new file.
Charles Szasz
[email protected]
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
How does the user create a new file -- from within Rev, eg, via a
button or some such, or by double-clicking the file icon on the
desktop? Does Rev open it in a Rev window, or does the file launch
using another app? How does a user open an existing file? -- again,
from within Rev or using the system software? It would help if you
described in more detail what the exact process is here, and what the
larger picture is -- what does your stack do?
As far as I can gather, the user opens an existing file "by script" --
so you have the file location stored somewhere. If the file is
launched using another app and then the contents are changed, the
system will provide the usual "save before closing?" dialog. At which
point the user can say "cancel" and instead "save as..." and choose a
new file name. If you are opening the file and editing it from within
Rev, eg in a field. then you can use the closefield message to give
the user the option of saving to the existing file. But I'm having to
guess what you want to do, since you haven't specified the details.
-- Peter
Peter M. Brigham
[email protected]
http://home.comcast.net/~pmbrig
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution