OpenAutomator and choose "Service" (the gear). Change "Service receives selected" to Files or folders in "Finder.app"
Add the "Run Applescript" step and then copy the code below and replace all the code in the "Run Applescript" command with this code.
Choose save, naming it something like "Make Protected Zip", then test it by going to the finder and selecting one or more files/folders. Scroll down to the "Services" Menu and select the service with the name you just saved as.
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 text returned of (display dialog "password for zipped file" default answer "password" buttons {"OK", "Cancel"} default button "OK")
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