AppleScript Droplet to create individual Zip files!

Hi There,

I have an AppleScript that works with Automator and I have saved it as an Automator Application. So it works like a droplet. The script helps me to create individual zip files of the selected folders/files.
The automator supports the AppleScript to “Application receives files and folders as input”.

Since, I recently upgraded to High Sierra (version 10.13.1), this Automator application is not working and I’m getting a ‘Not Allowed’ watermark on the application file.

Is there anyway the AppleScript can be tweaked to work as a Droplet without getting any help from Automator.

…and here is the AppleScript.

on run {input, parameters}
	-- create a PKZip archive of the selected Finder item(s)
	--	if no destination folder is specified, the archive will be placed in the same location
	-- input:	a list of Finder items to archive
	-- output:	a list of Finder items archived
	set output to {}
	set SkippedItems to {} -- this will be a list of skipped items
	set DestinationFolder to missing value -- a Finder path to a destination folder if different
	repeat with SomeItem in the input -- step through each item in the input
			set SomeItem to SomeItem as text
			if the last character of SomeItem is in {":", "/"} then set SomeItem to text 1 thru -2 of SomeItem
			set ArchiveSource to POSIX path of SomeItem
			if DestinationFolder is missing value then -- save the archive to the same location
				set ArchiveName to ArchiveSource & ".zip"
			else -- save the archive to the specified folder
				set TheName to name of (info for SomeItem as alias)
				set ArchiveName to (POSIX path of DestinationFolder) & TheName & ".zip"
			end if
			do shell script "ditto -ck " & (quoted form of ArchiveSource) & space & (quoted form of ArchiveName)
			set the end of the output to (POSIX file ArchiveName) as alias -- success
		on error ErrorMessage number ErrorNumber
			log ErrorMessage
			set the end of SkippedItems to SomeItem
		end try
	end repeat
	if SkippedItems is not {} then -- handle skipped items
		set TheCount to (count SkippedItems) as text
		display alert "Error with Archive action" message TheCount & " items(s) were skipped - workflow will continue"
        	choose from list SkippedItems with title "Error with Archive action" with prompt "The following items were skipped:" with empty selection allowed
		if result is false then error number -128 -- user cancelled
	end if
	return the output -- pass the result(s) to the next action

end run

Thanking you in anticipation.


Change the first line to:

on open input

Then recompile the script in Script Editor and save it as an application. (That is, when you save the script, choose “Application” in the “File Format:” pop-up at the bottom of the Save dialog and leave both “Options” boxes unchecked.)

Wow! that was so simple and so quick. Much appreciated.

Thanks a ton :slight_smile:

Oddly enough, the original script appears to work on Mojave.