I am attempting to use applescript to copy a folder to my desktop, zip it, then move the .zip file elsewhere but I can't get the zipping part to work.
I've looked everywhere for ways to zip a file/folder in applescript and I don't know what I'm doing wrong but none of them have worked for me.
I would also rather not have to choose the folder after it's been copied and the folder after it's been zipped but I thought I'd leave them till the zipping is fixed.
Any help at all would be greatly appreciated.
This is my code: (updated after help from djbazziewazzie)
set workspace to (path to desktop as text) --"Users:produser:Desktop"
tell application "Finder"
display dialog "Select a folder to be zipped"
set inputFolder to choose folder
set inputFolderProperties to properties of inputFolder
set inputFolderName to name of inputFolder
duplicate inputFolder to workspace with properties --copy input folder to workspace
{name:inputFolderName} --keep the same name
--set copiedFile to (workspace & inputFolderName)
display dialog "Select the folders desktop copy"
set copiedFile to choose folder --select the file copy thats on the workspace
tell current application
set qpp to quoted form of POSIX path of copiedFile
do shell script "zip -r " & qpp & ".zip " & qpp -- zips the file (or not...)
end tell
display dialog "Select the .zip file" --select the new .zip file
set zipFile to choose file
display dialog "Select the output folder"
set outputFolder to choose folder --moves zipped file
move zipFile to outputFolder
end tell