Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Stuffit should have cli for OS X, but...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Stuffit should have cli for OS X, but...
Authored by: macmath on Feb 01, '03 06:05:53PM

I agree, Aladdin should have cli commands available for Stuffit Expander and Stuffit, however, they probably want to continue to get as many people to have to buy Stuffit Deluxe as possible (for all those contextual menu thingys). In the mean time, if you do want to do something remotely (over TCP/IP) or automated with cron, you use AppleScript. Up until this most recent version (7.0.1), these products have been essentially immune from scripting (by me anyway :-)) except to open or close. With this version, one can script them to stuff and expand items. Here is a rough script to stuff all items in a particular folder and delete the original. It can be used with cron, or within a folder action (and therefore the location of the folder would not be required). I use it, and it works for me, but I'm sure it needs a lot of work to make it nice. Greater complexity is required because while stuffing via AppleScript, it does not know the item has already been stuffed, so I had to have it check.

tell application "Finder"
set item_count to count items in the container "users:shortname:documents:transfer"
end tell
if item_count is not equal to 0 then
set k to 1
repeat while k is less than (item_count + 1)
tell application "Finder"
set temp to item k of the container "users:shortname:documents:transfer:"
set next_file to temp as string
if ".sit" is not in next_file then
tell application "DropStuff"
open file next_file
end tell
tell application "Finder"
move next_file to trash
end tell
end if
set k to k + 1
end tell
end repeat
tell application "DropStuff"
quit
end tell
end if

To use Applescript over TCP/IP, the general tell command begins "Tell application "nameOfApp" of machine "eppc://..." The remote machine must be set up to allow Apple Events. Of course, it is a lot more typing. To stuff only one item, it would be much easier, but still a lot of typing.

tell application "Finder"
set temp to item 1 of the container "users:us:bin:"
set the_file to temp as string
tell application "DropStuff"
open file the_file
end tell
end tell

If you knew the name of the file, that would make it easier as well

tell application "DropStuff"
open file "pathToFile"
end tell

Sorry for the long post.



[ Reply to This | # ]
More flexibility with Script Editor 2.0 installed.
Authored by: macmath on Feb 01, '03 06:57:57PM

...by the way, if you have the 2.0 beta of Script Editor installed, you can write this script in any application to which "Services" are available (and in which you can enter text, such as TextEdit), and run the script from "Services". Thus, neither Script Editor nor compiled scripts are necessary.



[ Reply to This | # ]