Page 1 of 1
how can i have my program copy and paste an image file
Posted: Sun Apr 12, 2009 11:19 pm
by magice
Lets say i have an image file. It is at C:\Documents and Settings\Admin\Desktop\sample.jpg . I want to have my program copy and save it to a new location with a new name e.g. docs\images\newname.jpg. I want it all done behind the scenes without the end users input. What is the easiest way?
Posted: Mon Apr 13, 2009 3:01 am
by FourthWorld
Your thread title and message content describe two very different tasks.
If indeed all you want to do is move a file, the "rename file" command can change any elements of a file's path:
rename folder "C:/Documents and Settings/Admin/Desktop/sample.jpg" \
to "/docs/mages/newname.jpg"
Posted: Mon Apr 13, 2009 3:42 am
by magice
I tried that, however I don't want to remove the original file. instead I want to make a new copy in a new location. I think I might have found the answer though in the revCopyFile command. I just need to get it to work from inside a do command since the locations will be stored in variables. At least I feel like I am on the right track. Thank you
Posted: Mon Apr 13, 2009 7:09 am
by FourthWorld
put "/myfolder/myfile.jpg" into tSrcFile
put /myotherfolder/mynewfile.jpg" into tNewFile
put url ("binfile:"& tSrcFile) into url ("binfile:"&tNewFile)
if the result is not empty then
answer "Something went wrong with the file copy: "& sysError()
else
answer "File copied well. Nifty, eh?" with "Cool"
end if