Hi Guy’s
I’m trying to make an applescript that generate folders within eachother. I’ve so far done this script below, but the success rate on people being able to create the folders correctly in the first place is not great as we have a filing convension which people will not stick to. What I now would like to do is have some sort of database, maybe filemaker where the Apple script references certain data within a drop down menus system.
For example if you had these options;
1st table is car manufacturers (The user then selects say Vauxhall out of the list)
2nt table then looks at models (The user then only gets a specific list of models of cars depending on the selection above)
3rd table then breaks this down to 4 Door Vectra Estate or 5 Door hatch etc. (Depending on which option the user selects it will then name the folder where we currently use “Enter Job Name” as Vaux_4DV_Est as this then has the values behind the scenes for selecting 4 Door Vectra Estate)
Is this possible?
Thanks
property subf_names : {“Psd_Eps_Tiff”, “Design/Stage 1/RT 1/Resource”, “Design/Stage 1/RT 1/PDF”, “Design/Stage 2”, “Based On”, “Artwork”}
display dialog “Enter job name:” default answer “job name”
set j_name to text returned of result
repeat
display dialog “Enter job number:” default answer “0”
set j_number to text returned of result
try
if (j_number as integer) < 100000 and ¬
(j_number as integer) > -1 then exit repeat
on error
display dialog “Error: enter an integer less than 100,000.”
end try
end repeat
set job_number to text -6 thru -1 of (“00000” & j_number & “_”)
set temp_name to job_number & j_name
set theDestinationFolder to choose folder
tell application “Finder”
--set main_folder to (make new folder at desktop with properties {name:temp_name}) as alias
set main_folder to (theDestinationFolder make new folder at theDestinationFolder with properties {name:temp_name}) as alias
end tell
repeat with child in subf_names
do shell script "cd " & quoted form of POSIX path of main_folder & "; mkdir -p " & quoted form of child
end repeat
tell application “Finder”
set tim_file to file “Macintosh HD:Volumes:company name:Clients:Default Template:Design.ai”
duplicate tim_file to folder “Design:Stage 1:RT 1” of folder main_folder
set name_file to file "Design.ai" of folder "Design:Stage 1:RT 1" of folder main_folder
set newFile to name_file
set name of newFile to temp_name & ".ai"
end tell