Close File question

Mark Schonewille m.schonewille at economy-x-talk.com
Tue Oct 26 12:04:23 EDT 2010


Hi Charles,

The line

if it = "Don't Save" then close file "file:" & gOpenDataFile -->New 10-25-10: Close file 

should be:

if it = "Don't Save" then close file gOpenDataFile -->New 10-25-10: Close file

I don't see an open file command in your script. Do you keep the file open all the time? You might get an error "file already open" if your application crashes and tries to open it again the next session. You won't be able to determine whether another programme is using that file or the file is incorrectly flagged as open. You may also have a problem when you try to delete the file. I would recommend to keep files closed while you're not reading or writing.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Download the Installer Maker plugin for Runtime Revolution at http://qurl.tk/ce Create installers for Mac and Windows on *every* Rev-compatible platform. No additional software needed.

On 26 okt 2010, at 17:42, charles61 wrote:

> 
> Hi Mark,
> 
> This is the script that I have tried using the close command for "Don't Save". I tried the following which did not work in the script below: 
> Close file "file:" & gOpenDataFile
> 
> 
> case "New Student Referral"
>      go to card "referral"  
> 
>      if field "first" of card "referral" is not empty then ---> Name field is not empty.
>         if gOpenDataFile is not empty then  ---> A saved file is open.
>            set the itemDel to "/"
>            put item -1 of gOpenDataFile into tFileName
>            answer warning "Save changes to " & tFileName &"?" with "Don't Save" or "Cancel" or "Save" titled "Save File"
> 
>            --->answer warning "Save changes to: "with "Don't Save" or "Cancel" or "Save" titled "Save File?"
>            --->Your changes will be lost if you do not save them.
> 
>            if it = "Don't Save" then close file "file:" & gOpenDataFile -->New 10-25-10: Close file 
> 
> 
> Charles Szasz
> cszasz at mac.com
> 




More information about the use-livecode mailing list