At 09:16 3/1/2001, Stephen Recker wrote:

>on mouseUp
>   --put file name here
>   fileToCopy = "tester.txt"
>   --put file path here
>   if the platform contains "mac" then
>     whereIsFile = the moviePath & "source:" & fileToCopy
>   else
>     whereIsFile = the moviePath & "source/" & fileToCopy
>   end if
>   set myFile = new(xtra "fileio")
>   set fileName = displaySave(myFile, "Save file as:", fileToCopy)
>   openFile(myFile,filename, 1)
>   set theFile = readFile(myFile)
>   closeFile(myFile)
>   set myFile = 0
>   baCopyFile(whereIsFile,filename,"ifNewer")
>end
>
>I'm using FileIO to bring up a file dialog and Buddy to copy it. Any
>comments would be appreciated. TISA

I would avoid using Director keywords for variables. Maybe fName in place 
of fileName.

Since you're just getting a file name from the user, there's no need to go 
through the open/read/closeFile functions. All you really need to do is 
check whether they've supplied a file name or not. IIRC, fileIO's 
displaySave() returns an empty string if the user cancels - double check me 
on that, though.

-- untested email Lingo
set myFile = new(xtra "fileIO")
set fName = displaySave(myFile, "Save file as:", fileToCopy)
set myFile = 0
if fName <> "" then
   rezult = baCopyFile(whereIsFile,fName,"ifNewer")
   if rezult <> 0 then
     -- alert the user why the file couldn't be copied
     -- see BudAPI help for error codes
   end f
end if



--
Mark A. Boyd
Keep-On-Learnin' :)


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to