Re: get Applescript to act on a file once it has been downloaded
Re: get Applescript to act on a file once it has been downloaded
- Subject: Re: get Applescript to act on a file once it has been downloaded
- From: "koenig.yvan" <email@hidden>
- Date: Fri, 11 Jul 2014 16:55:29 +0200
Le 11/07/2014 à 16:15, William Adams < email@hidden> a écrit : I'm downloading a file w/ the command:
set newfile to "/Volumes/FIS/Customer/CLIENTNAME/2015_Ads/Test/" & newFileName & ".eps"
set download_path to "ftp://" & ftpUserName & ":" & ftpPassword & "@" & ftpHost & "//" & "o7/" & ftpSubDirectory & "/" & ftpSourceDirectory & "/" & originalFileName & ".eps"
do shell script "curl -o " & quoted form of newfile & " " & quoted form of download_path
and the file downloads fine.
Attempting to access it as an alias the fails though, and trying to get the script to wait for the file to appear using:
tell application "Finder" activate repeat while not (exists POSIX file newfile) delay 0.5 end repeat end tell
results in an endless repeating of:
exists POSIX file "/Volumes/FIS/Customer/CLIENTNAME/2015_Ads/Test/BT150453.eps" --> false exists POSIX file "/Volumes/FIS/Customer/CLIENTNAME/2015_Ads/Test/BT150453.eps" --> false
Even though I can see the file in Finder.
How does one get Applescript to:
- wait for a file to be downloaded completely - act on the file once it is present (I need to copy it to a folder, then re-upload it under a new name)
William
Hello
I’m not sure that it’s the real problem but using POSIX file newfile in a tell application "Finder" block is not a good idea because the function belongs to an OSAX : Standard Additions.
It would be better to use :
tell application "Finder" activate repeat tell me to POSIX file newfile if not (exists result) then exit repeat delay 0.5 end repeat end tell
I’m not accustomed to download files thru curl but I'm surprised to see that you insert a colon (:) in download_path.
Yvan KOENIG (VALLAURIS, France) vendredi 11 juillet 2014 16:55:25
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden