apple script
I am trying to make a script that creates a job folder, with subfolders, for working files.
I acheived that with the script below.
tell application "Finder"
with timeout of 6000 seconds
set loc to choose folder with prompt "Choose a location" default location "Volumes/Prepress"
set JobNumber to text returned of (display dialog "Please enter Job Number (5 digits):" default answer "")
set JobDiscription to text returned of (display dialog "Please enter a Job Discription:" default answer "")
set newfoldername to JobNumber & "_" & JobDiscription
set newfo to make new folder at loc with properties {name:newfoldername}
make new folder at newfo with properties {name:JobNumber & "_Imposition"}
make new folder at newfo with properties {name:JobNumber & "_Originals"}
make new folder at newfo with properties {name:JobNumber & "_Output"}
make new folder at newfo with properties {name:JobNumber & "_PageLayout"}
make new folder at newfo with properties {name:JobNumber & "_PDF_Digital"}
make new folder at newfo with properties {name:JobNumber & "_PDF_Indigo"}
make new folder at newfo with properties {name:JobNumber & "_PDF_Press"}
make new folder at newfo with properties {name:JobNumber & "_PDF_WideFormat"}
make new folder at newfo with properties {name:JobNumber & "_Proof"}
make new folder at newfo with properties {name:JobNumber & "_Support"}
end timeout
end tell
I wanted to change the script to automatically point to the path in an active Finder window, but I am getting the error: Can’t make current application into type location reference. Below is my modified code. What am I doing wrong? I am not very experienced in AppleScript.
tell application "Finder" to set fItemList to (selection as alias list)
with timeout of 6000 seconds
if ((count of fItemList) = 0 or (kind of (info for (item 1 of fItemList)) ≠ "folder")) then
tell application "Finder" to set fItemPath to POSIX path of (target of front window as text)
else
set fItemPath to POSIX path of (item 1 of fItemList)
end if
set loc to choose folder with prompt "Choose a location" default location fItemPath
set JobNumber to text returned of (display dialog "Please enter Job Number (5 digits):" default answer "")
set JobDiscription to text returned of (display dialog "Please enter a Job Discription:" default answer "")
set newfoldername to JobNumber & "_" & JobDiscription
set newfo to make new folder at loc with properties {name:newfoldername}
make new folder at newfo with properties {name:JobNumber & "_Imposition"}
make new folder at newfo with properties {name:JobNumber & "_Originals"}
make new folder at newfo with properties {name:JobNumber & "_Output"}
make new folder at newfo with properties {name:JobNumber & "_PageLayout"}
make new folder at newfo with properties {name:JobNumber & "_PDF_Digital"}
make new folder at newfo with properties {name:JobNumber & "_PDF_Indigo"}
make new folder at newfo with properties {name:JobNumber & "_PDF_Press"}
make new folder at newfo with properties {name:JobNumber & "_PDF_WideFormat"}
make new folder at newfo with properties {name:JobNumber & "_Proof"}
make new folder at newfo with properties {name:JobNumber & "_Support"}
end timeout
Mac Pro (2023)