Hi all,
So I don’t want to be a nudge or lazy or anything, but I’m new to scripting, and I need help completing my first script. This is a folder action and what I’m trying to do, if it isn’t apparent, is to write a script where upon being added to a folder, the file is added to a uniquely named Stuffit archive in a different folder, and encrypted. I need the new archive to not contain “.mp3” in its name.
on adding folder items to this_folder after receiving these_items
tell application “Finder”
if not (exists folder “Stuffed” of this_folder) then
make new folder at this_folder with properties {name:“Stuffed”}
end if
set the destination_folder to folder “Stuffed” of this_folder as
alias
set the destination_directory to POSIX path of the
destination_folder
end tell
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
set the item_info to info for this_item
if this_item is not the destination_folder and the name extension of
the item_info is not in {“zip”, “sit”} then
set the item_path to the quoted form of the POSIX path of
this_item
set the destination_path to the quoted form of
(destination_directory & (name of the item_info) & “.sit”)
with timeout of 1500 seconds
tell application “StuffIt Deluxe”
activate
make new archive with properties {name:first text item
of this_item & “.lfp”, location:destination_folder}
stuff {this_item} into archive passphrase “xxxxxxxxxx”
compression level maximum
quit
end tell
end timeout
end if
end repeat
end adding folder items to
I should add that I’m aware of shell script archiving (many scripters will immediately see how much of this script is cobbled from the one on Apple’s own site) but would rather use Stuffit for my own reasons. Any help would be appreciated. Thanks!