Strange behavior from StuffIt Commands osax
Strange behavior from StuffIt Commands osax
- Subject: Strange behavior from StuffIt Commands osax
- From: "Marc K. Myers" <email@hidden>
- Date: Thu, 01 Mar 2001 04:53:09 -0700
- Organization: [very little]
I wrote the following script under OS 8.1 as a droplet to Stuff and
BinHex whatever Finder items are dropped on it. It worked as expected
on the original machine. Today I tried to transfer it to an OS 9.0.4
machine. It ran as expected from the Script Editor, but when saved as a
droplet it makes a copy of the original file (with an appended suffix)
and proceeds to Stuff and BinHex the copy instead of the original.
Does anyone have an idea as to why this is happening and, I hope, a way
to get around it?
on run
set theButton to button returned of (display dialog "I want to " & [optn-L]
"Stuff and BinHex " & [optn-L]
"a" buttons {"Cancel", "File", "Folder"} default button 3)
if theButton is "Cancel" then
error number -128
else if theButton is "File" then
open {(choose file with prompt "Pick a file:")}
else
open {(choose folder with prompt "Pick a folder:")}
end if
end run
on open (itemList)
try
-- requires Jon's Commands
set theKeys to (keys pressed)
on error
set theKeys to {}
end try
if (count itemList) > 1 then
tell application "Finder"
set thePath to [optn-L]
((the container of item 1 of itemList) as text) & "Archive"
end tell
else
set theText to item 1 of itemList as text
if character -1 of theText is ":" then
set thePath to [optn-L]
((text from character 1 to character -2 of theText) as text)
else
set thePath to theText
end if
end if
set sitFile to (thePath & ".sit")
-- requires StuffIt Commands
Stuff (contents of items of itemList) into file sitFile
set hqxFile to (thePath & ".hqx")
if theKeys contains {"Option"} then
-- requires StuffIt Commands
BinHex file sitFile into file hqxFile
else
-- requires StuffIt Commands
BinHex file sitFile into file hqxFile with deleting originals
end if
end open
Marc [3/1/01 4:50:59 AM]