Making my text editor save the work

Derek Bump webmaster at dreamscapesoftware.com
Fri Mar 11 23:13:43 EST 2005


Kevin,

This is the standard save/save as script that I use.  The target file is 
stored in the Global Variable "targetFile".  It works like this, if the 
targetFile is empty or if you pass the parameter "true" then it will ask 
where you want to save the file.  The script is as follows...


on doSave saveAs
    global targetFile
    if (saveAs is "true") or (targetFile is empty) then
       ask file "Save File As..." with "Untitled.txt"
       if it is empty then exit to top
       put it into targetFile
    end if

    -- Then do what your script wants
    put fld "txtWindow" into URL ("file:" & targetFile)
end doSave


Just remember that when you close the file, remember to put empty into 
targetFile, otherwise you'll overwrite the file with future changes.

Derek Bump
Dreamscape Software
_______________________________________________
Compress Images Easily with JPEGCompress 2.5
http://www.dreamscapesoftware.com/



More information about the use-livecode mailing list