I would check the path.
The LeftValues( ) function adds always a carriage return to the result; try instead the GetValue ( ) function.
i changed to GetValue and that got rid of the carriage return,
but i'm still having problems getting the file to my desktop.
"file:" is a relative path, while the Get(DesktopPath) gives a full path (on PC at least - haven't tried it on a Mac). Try "filemac:" and "filewin:" in front of $filepath instead.
You will need to use the Get(SystemPlatform) command to use the correct one since the solution is going to be cross-platform.
thank you for the suggestion, i tried "filemac:" since i am testing on a mac, but the file still does not appear on the desktop.
i added a save dialog box in the SCDownload command, to see where the file was saving, and it has the correct filename and appears to go through the motions, but just doesn't appear on the desktop or in the email.
Don't know if this will help, but here is an example of my script:
#Check if image exsits
Set Variable [$resulta; Value:SCSetBaseURL(http://fmserver.dev:8020/SuperContainer/Files") and SCGetInfo("images/"&image::ImageDateName&"/"image::UID:)]
#Download Image - downloads image and saves it to temp dir and renames it.
Set Variable [$image; Value:image::UID&".jpg"]
Set Variable [$result; Value:SCSetBaseURL(http://fmserver.dev:8020/SuperContainer/Files") and SCDownload("images/"&image::ImageDateName&"/"image::UID; "Macintosh_HD/Databases/Temp/";0;0; "filename="&$image)]
You could also read my article: http://www.zerobluetech.com/blog/exporting-container-fields-to-folders-from-filemaker/
Might spark some ideas.
FileMaker 10 and 11 Certified Developer
C 917 660-7221
Member, FileMaker Business Alliance
Member, FileMaker Technical Network