how can i have my program copy and paste an image file
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
how can i have my program copy and paste an image file
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?
-
- VIP Livecode Opensource Backer
- Posts: 10049
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
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"
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"
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
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
-
- VIP Livecode Opensource Backer
- Posts: 10049
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
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
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
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn