FW: Folder Actions technical questions
FW: Folder Actions technical questions
- Subject: FW: Folder Actions technical questions
- From: Gnarlodious <email@hidden>
- Date: Mon, 03 Apr 2006 15:56:42 -0600
- Thread-topic: Folder Actions technical questions
Please note... the correct address to send this to is
email@hidden
------ Forwarded Message
From: Mark Siple <email@hidden>
Date: Mon, 03 Apr 2006 17:34:51 -0500
To: "email@hidden"
<email@hidden>
Conversation: Folder Actions technical questions
Subject: Re: Folder Actions technical questions
Resent-From: Mark Siple <email@hidden>
Resent-To: <email@hidden>
Resent-Date: Mon, 03 Apr 2006 17:48:36 -0500
All:
Thank you very much for your help. I've converted my folder action into an
idle applet that seems to work well (though I haven't thoroughly tested it
yet!!)
Thanks especially to John C. Welch for including the code for looping until
the file is complete. I was thinking along those lines but hadn't actually
started to code it. Your sample made it nearly a drag and drop affair. ;-)
Here's the relevant part in the hopes of helping someone else:
on idle
tell application "Finder" to set foundfiles to (count files in folder
((startup disk as string) & "Library:FTPServer:FTPRoot:FromServer:"))
if foundfiles is greater than 0 then
-- grab list of files for processing
tell application "Finder" to set imagefiles to files in folder
((startup disk as string) & "Library:FTPServer:FTPRoot:FromServer:")
--save Applescript's current delimiters
set olddelim to AppleScript's text item delimiters
repeat with zipfullpath in imagefiles
-- extract folder and file from full path
tell application "Finder" to set zippath to container of
zipfullpath as string
set AppleScript's text item delimiters to ":"
set zipfile to text item -1 of (zipfullpath as text)
--loop until file transfer is complete
set fileinfo to info for alias (zippath & zipfile)
set originalsize to size of fileinfo
delay 3
set fileinfo to info for alias (zippath & zipfile)
set newsize to size of fileinfo
repeat while originalsize newsize -- loop until same size
set originalsize to newsize
delay 2
set fileinfo to info for alias (zippath & zipfile)
set newsize to size of fileinfo
end repeat
[ DO A BUNCH OF OTHER PROCESSING OF THE FILE(S) ]
end if
return 5
end idle
Compile and save as an application but be sure to check the STAY OPEN box.
Mark.
-----
Mark Siple <email@hidden>
Systems Administrator
The Columbus Dispatch
"Never ask a man what sort of computer he drives.
If it's a Mac, he'll tell you.
If not, why embarrass him?" -- Tom Clancy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
0gmail.com
This email sent to email@hidden
------ End of Forwarded Message
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden