SO, I want to create an app in automator that lets me drop a file on it, then do the shell script- “lzma --d -k && path_of_dropped_file”
Can I do this?
Model: iMac Late '06
AppleScript: Whatever comes with 10.4.11
Browser: Firefox 3.0.1
Operating System: Mac OS X (10.4)
Hi jpenguin,
I cannot offer you an Automator solution, but how about this AppleScript droplet that does what you want? Just copy and paste the code into a new Script Editor document and save it as an Application/Application bundle.
on open droppeditems
repeat with droppeditem in droppeditems
set itempath to POSIX path of (droppeditem as Unicode text)
set command to "lzma --d -k && " & quoted form of itempath
try
do shell script command
on error errmsg number errnum
my dsperrmsg(errmsg, errnum)
end try
end repeat
end open
on dsperrmsg(errmsg, errnum)
tell me
activate
display dialog "Sorry, an error occured:" & return & return & errmsg & return & "(" & errnum & ")" buttons {"OK"} default button 1 with icon caution giving up after 20
end tell
end dsperrmsg
Thx
I did end up using the old PPC SciptEditor to do this, I also added a way to compress non LZMA files with lzma
on open draggedItems
tell application "Finder"
repeat with eachFile in draggedItems
if the name of eachFile does not contain ".lzma" then
set fName to quoted form of POSIX path of eachFile
do shell script "/usr/local/bin/lzma -z -k " & fName
else
set fName to quoted form of POSIX path of eachFile
do shell script "/usr/local/bin/lzma -d -k " & fName
end if
end repeat
end tell
end open
on run
display dialog "Drag and drop *.lzma files onto this icon to decompress them. Or, drag a file that does not end with .lzma over this icon to compress it. LZMA does not work on folders." buttons {"Close"} default button 1
end run
This works fine, but it is still a PPC application, so I guess I need to port it to Apple Script Studio
BTW-- If anyone wants to check this out, it requires http://tukaani.org/lzma/LZMA-Utils-4.32.6.pkg.zip to be installed---------LZMA is arelly good compression program, with a compression ratio better than bzip2!
Model: iMac Late '06
AppleScript: Whatever comes with 10.4.11
Browser: Firefox 3.0.1
Operating System: Mac OS X (10.4)
Saving a script as application bundle creates always an Universal app (on Tiger and Leopard)