set targetFile to (path to temporary items as string) & fileName
I am trying to download a web image to temporary folder by curl in a Apple Script.
According to the above code, the curl downloads it as correct but the targetFile is currently as:
Macintosh HD:private:var:folders:...TemporaryItems:image.png
But after download, I need the downloaded image path as a correct file path like:
/tmp/image.png
How can I set targetFile
as a string that have slash containing file path? Or how can I get the file path of the image after it is downloaded by curl?
Best Answer
You can work around this with something like
This AppleScript will make a string containing
/tmp/
, and targetFile sets it to interpret as POSIX (used by shell and curl). Then it downloads images.jpeg and stores it as fileName