I'm trying to create a script that copies a template folder to current finder window then renames the new folder and a couple of files within it based on dialogue input.
So far, I've got it so it can copy a folder (from a selection) to the current finder window and rename it. But I can't get it to then rename a file within it.
Here's the code -
property A : POSIX file "/BLOCKED OUT FOR PRIVACY/" as alias
property B : POSIX file "/BLOCKED OUT FOR PRIVACY/" as alias
property C : POSIX file "/BLOCKED OUT FOR PRIVACY/" as alias
property D : POSIX file "/BLOCKED OUT FOR PRIVACY/" as alias
tell application "Finder"
set x to target of window 1 as alias
end tell
set JobName to text returned of (display dialog "Enter Folder Name:" default answer "Template Folder")
set CATno to text returned of (display dialog "Enter CAT number:" default answer "CMXX0000")
set optionList to {"OPTION 1", "OPTION 2", "OPTION 3", "OPTION 4"}
set chosenFolder to choose from list optionList with prompt "Choose a Folder"
set chosenFolder to chosenFolder's item 1
if chosenFolder is "OPTION 1" then
tell application "Finder"
set FolderCopy to duplicate B to x
set the name of FolderCopy to JobName
set Insert to (POSIX path of (path to home folder)) & "DVD Insert Artwork/Indesign Project File/_Insert.indd" as POSIX file
set the name of Insert to JobName & CATno
end tell
end if
I've cut out the POSIX file paths as they contain my company name and such. I've also left out the other parts of the if as they'll essentially be duplicates of the first.
set Insert to (POSIX path of (path to home folder)) & "DVD Insert Artwork/Indesign Project File/_Insert.indd" as POSIX file
set the name of Insert to JobName & CATno
This is the part that's giving me trouble. It should be renaming a file that is within the newly duplicated folder to the what's entered in the CATno dialog box + "_Insert.indd"
Any help is greatly appreciated!
Thanks :)