Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Service to "Make Protected Zip" files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Service to "Make Protected Zip" files
Authored by: David Hein on Oct 17, '13 02:52:15PM

i would like to use this but the main one input on 10.9 does not work. the comments left me confused since i don't do applescript. thanks, looking forward to using this.



[ Reply to This | # ]
Service to "Make Protected Zip" files
Authored by: Fofer on Oct 18, '13 07:32:18AM

Same issue here - I'd love to see this AppleScript updated for 10.9 compatibility.



[ Reply to This | # ]
Service to "Make Protected Zip" files
Authored by: chocky on Oct 21, '13 09:11:43PM
I just tested the modified version in Mavericks GM and it works just fine. Here's a complete modified version:

on run {input, parameters}
	set dialogResults to display dialog "Name for zipped file (no extension)" default answer "Archive" buttons {"OK", "Cancel"} default button "OK"
	if button returned of dialogResults is "OK" then
		
		set passwd to "x"
		set passwd_2 to "y"
		repeat while passwd ≠ passwd_2
			tell application "System Events"
				activate
				set passwd to text returned of (display dialog "password for zipped file" default answer "" buttons {"OK", "Cancel"} default button "OK" with hidden answer)
				set passwd_2 to text returned of (display dialog "Please reenter your password" default answer "" buttons {"OK", "Cancel"} default button "OK" with hidden answer)
			end tell
			
		end repeat
		
		set archiveName to text returned of dialogResults
		
		tell application "Finder"
			set archiveFileName to archiveName & ".zip"
			-- Append on a number if file exists.
			set suffix to 1
			set theFileExists to true
			repeat while theFileExists
				try
					set archiveFile to ((container of (item 1 of input) as Unicode text) & archiveFileName)
					if exists file archiveFile then
						set archiveFileName to archiveName & suffix & ".zip"
						set suffix to suffix + 1
					else
						set theFileExists to false
					end if
				end try
			end repeat
		end tell
		set itemStr to ""
		repeat with thisItem in input
			set itemPath to quoted form of (POSIX path of thisItem)
			tell application "Finder"
				set parentFolder to POSIX path of (container of thisItem as alias)
			end tell
			set itemStr to itemStr & " " & itemPath
		end repeat
		set zipFile to quoted form of (parentFolder & archiveFileName)
		set cmd to "zip -P " & passwd & " -rj " & zipFile & " " & itemStr & " -x *.DS_Store"
		do shell script cmd
	end if
	return
end run


[ Reply to This | # ]