Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > segfault - How to AppleScript "Compress" in Finder?

segfault - How to AppleScript "Compress" in Finder?
Thread Tools
rslifka
Forum Regular
Join Date: Dec 2004
Status: Offline
Reply With Quote
Jan 22, 2005, 03:11 PM
 
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
     
suthercd
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Jan 23, 2005, 03:24 PM
 
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
     
Rickster
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Jan 23, 2005, 06:02 PM
 
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.
Rick Roe
icons.cx | weblog
     
rslifka  (op)
Forum Regular
Join Date: Dec 2004
Status: Offline
Reply With Quote
Jan 23, 2005, 10:55 PM
 
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 Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 09:51 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,