|
|
segfault - How to AppleScript "Compress" in Finder?
|
|
|
|
Forum Regular
Join Date: Dec 2004
Status:
Offline
|
|
When I zip giant files from "do shell script", AppleScript segfaults, so I'm looking for a non-command-line way to do it.
Finder has "Compress" but I can't seem to find this in the Finder dictionary. Does that mean it's not there?
That would be a shame
Rob
|
|
|
|
|
|
|
|
|
Senior User
Join Date: Oct 2000
Location: Midwest
Status:
Offline
|
|
Posting your code with the question will help. The Archive capability in integrated into 10.3, the only tangible evidence is ~/Library /Preferences/com.apple.bomarchivehelper.plist. Using gzip and gnutar with the do shell script worked for me, cpu intensive but achieving the same level of compression as Archiving the same file via Finder. Add a try block to this-
Code:
set itemToZip to (choose file)
do shell script "gzip " & quoted form of POSIX path of itemToZip
I tested on a 300MB file without problems.
Craig
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status:
Offline
|
|
Finder's "Archive" command is implemented by the BOMArchiveHelper app in /System/Library/CoreServices. Unfortunately, it doesn't seem to have an AppleScript dictionary. You could just throw files at it with the universal "open" event, but those come out as CPGZ archives instead of zip. (Maybe there's a preference that can be written to make that change?)
Using other command-line utils via "do shell script" seems like a good enough solution. Remember you might want to use a "with timeout" block if you expect to be compressing files large enough that it takes a long time.
|
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Dec 2004
Status:
Offline
|
|
Hey guys, thanks for the replies!
I didn't paste any code because the core of it was just having a single line "do shell script ditto / zip / whatever" and it would crash/hang.
That timeout thing sounds like a good cure for what ails me.
Kinda stinks that the Archive functionality isn't exposed. I bet in Tiger I'll be able to use the Automator!
Rob
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|