Question

I’m new to the forum and relatively new to scripting and wanted to ask a question.

I’m trying to script a workflow where when prompted, users create a folder and when the script executes, a dialogue pops up. Users name the folder, for example; NewFolder1, it is then saved in a directory. Another folder is then created in the background, into another directory with the same name created by the user earlier, but appended with a prefix, for example; Name_ NewFolder1.

I then want sub folders created in each directory as well as alias folders which point to Name_ NewFolder1 created in the original (NewFolder1) directory

I'm on a mac and I can do most of this via applescript or automator but am stuck on the initial creating 'NewFolder1' and 'Name_ NewFolder1' at the same time in the two separate directories.

I only want to prompt the user to name one folder rather than show them two dialogues for 'NewFolder1' and 'Name_ NewFolder1'

Does anyone have any ideas of how i can achieve this? Either via a shell, applescript or UNIX

Thank you

Was it helpful?

Solution

Here's how to do the part you're stuck on in AppleScript:

set folder_name to text returned of (display dialog "What is the folder name?" default answer "untitled")

set second_name to "Name_" & folder_name

tell application "Finder"
    make new folder at desktop with properties {name:folder_name}
    make new folder at desktop with properties {name:second_name}
end tell

OTHER TIPS

`set client_name to text returned of (display dialog "Create Folders:" default answer "Type here") set loc1 to ":path1" set loc2 to ":path2"

set clientmedia_name to "name_" & client_name

tell application "Finder" make new folder at loc2 with properties {name:clientmedia_name}

set new to make new folder at loc1 with properties {name:client_name}
make new folder at new with properties {name:"1"}
make new folder at new with properties {name:"2"}
make new folder at new with properties {name:"3"}
make new folder at new with properties {name:"4"}

end tell`

This is how far i have got, but can't seem to create folders in the clientmedia_name dir

Thanks,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top