Stuffit Problems

Hi there,

I’m trying to create a script that will individually stuff folders dropped on to it.

I’ve read a few posts and come up with this so far.

on open (someFiles)
	repeat with this_folder in someFiles
		tell application "Finder"
			set the_path to (container of (this_folder)) as string
			set archiveName to (name of this_folder) & ".sitx"
			set aliasFolder to this_folder as alias
		end tell
		tell application "StuffIt Deluxe"
			set x to make new archive with properties {location:file (the_path & archiveName as string)}
			with timeout of 1 second
				stuff aliasFolder into x compression level maximum
				delay 0.5
			end timeout
			close x
		end tell
	end repeat
	tell application "StuffIt Deluxe" to quit
end open

The folders appear to stuff ok, however when I try to un-stuff them I get an error.

Please can someone help,

Thanks,

Nick

TecNik,

Just browsing over your code, your statement:

with timeout of 1 second

is probably far too short a time to let stuffit finish stuffing your file. I ran your code and it works, but gives an applescript timeout error. Try changing the timeout to 600 or more seconds. Also I’m not sure of the purpose of the “delay 0.5” statement. I believe it is unnecessary here.

on open (someFiles)
	repeat with this_folder in someFiles
		tell application "Finder"
			set the_path to (container of (this_folder)) as string
			set archiveName to (name of this_folder) & ".sitx"
			set aliasFolder to this_folder as alias
		end tell
		tell application "StuffIt Deluxe"
			set x to make new archive with properties {location:file (the_path & archiveName as string)}
			with timeout of 600 seconds
				stuff aliasFolder into x compression level maximum
				--delay 0.5
			end timeout
			close x
		end tell
	end repeat
	tell application "StuffIt Deluxe" to quit
end open

This works for me.

PreTech

Hi Pretech,

Thanks for your help with this.
I amended the script as you’d mentioned, increased the timeout and deleted the delay. I’d put the delay in to see if it helped things.

On trying the amended script it seemed at first to do a better job. However, when I came to unstuff the .sitx file, I’m being asked for a passphrase? I’ve had a look at stuffit’s dictionary and have found the passphrase property. Is it something that has to be turned off?

When I look inside the .sitx file I can see items which have a key on the icon as if if the file is locked, that probably explains why I’m being asked for a passphrase.

I did find this article on Apple’s site but no solution:-

http://lists.apple.com/archives/Applescript-users/2005/Nov/msg00591.html

Any further help on this would be appreciated.

Thanks in advance,

Nick

Nick,

On my version of stuffit, in the preferences, I do not have the passphrase checked. I don’t use this function and unfortunately, am not sure if this is something that is scriptable when unstuffing a file. The dictionary doesn’t show that it is, but that doesn’t mean that it can’t be. If you don’t need this, I’d uncheck that item in your preferences.

Sorry I couldn’t help much more on this.:frowning:

PreTech

Hi Pretech,

Thanks for your reply.

Yeah, I’d the prefs and switched off the passphrase option, that’s why I couldn’t understand why it was asking for one. I think it’s something to do with the script because if you stuff and unstuff the file manually it’s all ok.

I’ll keep trying and see if I can come up with something. I may try doing it with some UI Scripting.

Thanks again,

Nick

Hi Jacques,

Thanks for your help with this query, your code worked great, and did just what I required.
I’d not realised that the passphrase property needed specifying, or Stuffit would put one on.

Having looked through your code I’ve noticed one or two other small differences which may have made a difference.

Thanks again Jacques.

Regards,

Nick