Problem saving files

David C. davidocoker at gmail.com
Tue Jul 6 00:22:35 CDT 2010


I've run into a bit of a head scratching problem with saving files
that maybe someone can help me sort out.
My code:

on SaveTheFile
   ask file "Save project as:" with filter "MYFL file,*.myfl"
   if it <> "" then
      put it into tfile
      put fld "save list" into tFiletoSave
      put tFileToSave into url ("file:" &  tfile & ".myfl")
   else
      exit to top
   end if
 end SaveTheFile

 The file saves exactly as expected *if* there isn't a file with the same name.
 Example from code above, the filename written would be: myfilename.myfl

If there is a file with the same name, it correctly asks if I want to
replace it, but when I click yes, instead of overwriting the file
properly, it still creates a new file, but with the extension doubled
up, as in: myfilename.myfl.myfl

The other ways I've tried to code it, it still does the "do you want
to replace" routine and will overwrite the file without doubling up on
the extension, *but* it won't automatically add the proper extension
to a new file.

Nothing unusual or special needed. All I'm looking for is to have it
write a new file with the proper extension automatically added -or- to
correctly overwrite an existing file, especially without doubling up
the preferred extension.

 I've read the documentation and tried it so many different ways now,
that I'm confused to the point that I'm unsure what to try next...

This is the last "little problem" to solve in order to complete a
pretty large project, so I would sincerely appreciate any help you can
send my way!

Best regards,
David C.



More information about the use-livecode mailing list