Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Command: Compress Files in A Folder Individually

Dear MacUnix Gurus:


Need your help on AppleScript and Commandline.


How to create an AppleScript droplet which will trigger a BASH command which, preserving Resource Forks and the extended attributes, compresses the files within a folder individually.


Many Thanks!


MaX NYC

Posted on Sep 2, 2012 8:02 PM

Reply
19 replies

Nov 11, 2012 6:29 PM in response to Max NY

I'm not sure what there is to elaborate. if you use the timeout block, it tells the script to wait for at least one hour for a result before considering the event to be a timeout (this opposed to the normal script timeout of one minute). if you put the timeout block around a do shell script and it fails, that means that the do shell script never returned a result. (crashed or zombie process, maybe?)


However, you say that the timeout is coming from System Events. There's only one command sent to system events in the script that I gave, asking for a list of disk item paths from the folder, and it seems unlikely that would time out. I assume you've done modifications to the script, so you'll have to post the script you're actually usig for me to say more.

Nov 12, 2012 10:28 PM in response to twtwtw

TwTwTw:


Thanks for your effort!


I followed your Script. The only modification is on the typo: "destingationPath"! I changed it to "destinationPath"!


Later! I also followed your two new recommendations. However! If use the Script to compress folders which contain more than 100+ files, for extended period of time. "`AppleEvent' Timeout" error popped up.


I issued the command to clear the error, to get back to work:

SystemStarter restart "System Events"

or

killall -HUP "System Events"


If you google "AppleEventes Timeout OSX10.6," you will find a few commentaries.


Happy ThanksGiving!


MacX NYC

Nov 12, 2012 11:01 PM in response to Max NY

The only thing I see on Google are some timeout problems in 10.6.3: every 65k apple events you get a timeout, probably a problem with rolling over apple event ids. I sincerely doubt that's the problem here, though; you won't be running through 65k apple events in the course of a few hours. However, can you point me to some more specific commentary?


That being said, I had a thought (always a dangerous thing...). The script creates a list of POSIX paths in System Events, then starts processing that list outside of System Events. It's possible that that list of POSIX paths is created by reference rather than as a simple list of text items, and if so, then when SE quits itself - which it will do after (I think) 15 minutes of inactivity - the by-reference list items might break, hanging the script. That's easy to test: change the beginning of the script to reed so:


on opentheFolders

tell application "System Events" to set quit delay to 0


-- rest of script


set quit delay to 0 tells System Events to stay open indefinitely (which is not a problem; I leave SE running 24/7 and it's never caused issues). You could add another line at the end of the script telling SE to quit, if you so desire.

Command: Compress Files in A Folder Individually

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.