Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- display dialog "Choose where your file is located."
- set directory to POSIX path of (choose folder with prompt "File Location:" default location (path to desktop))
- display dialog "Choose your file."
- set filepath to (choose file with prompt "File Name:")
- tell application "Finder" to set {dispName, nameExt, isHidden} to ¬
- the {displayed name, name extension, extension hidden} of the filepath
- tell application "Finder" to set filename to ¬
- the {displayed name} of the filepath
- if isHidden or nameExt is equal to "" then
- dispName
- else
- (characters 1 through (-2 - (count of nameExt)) of dispName) as text
- end if
- set filenameNoEXT to result
- set encryptedFileName to text returned of (display dialog "Encrypted File Name:" default answer filenameNoEXT & "_" & "encrypted" & ".zip")
- if (encryptedFileName ends with ".zip") then
- set pass to text returned of (display dialog "Password:" default answer "" with hidden answer)
- set passC to text returned of (display dialog "Confirm Password:" default answer "" with hidden answer)
- if pass = passC then
- set deleteQ to display dialog "Do you want to remove the original file?" buttons {"Yes", "No"} default button 2
- set answer to button returned of deleteQ
- if answer is equal to "Yes" then
- do shell script "cd " & directory & ";" & "zip -re -P " & "'" & pass & "'" & " " & encryptedFileName & " " & filename & ";" & " rm -r " & filename
- else if answer is equal to "No" then
- do shell script "cd " & directory & ";" & "zip -re -P " & "'" & pass & "'" & " " & encryptedFileName & " " & filename
- end if
- else
- display dialog "Passwords did not match." with icon stop
- end if
- else
- display dialog "Encrypted File Name did not end with '.zip'." with icon stop
- end if
- -- Made By Dv3v
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement