Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with applescript creating folders



This works OMM.  The idea is you can include a list instead of a folder name and it treats the list as { parent, child, grandchild }, etc.  It doesn't allow for multiple subfolders past the first level, though. 

property subf_names : {{"Design", "Stage 1"}, "Based On", "Artwork"}

on make_subs(parent_folder, name_list)
    set this_folder to parent_folder
    repeat with elem in name_list
        if class of elem is list then
            tell application "Finder" to set next_folder to (make new folder at parent_folder with properties {name:item 1 of elem}) as alias
            make_subs(next_folder, items 2 through end of elem)
        else
            tell application "Finder" to make new folder at parent_folder with properties {name:elem}
        end if
    end repeat
end make_subs

--
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 ("0000" & j_number & "_")
set temp_name to job_number & j_name

tell application "Finder"
    set main_folder to (make new folder at desktop with properties {name:temp_name}) as alias
end tell

make_subs(main_folder, subf_names)
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Help with applescript creating folders (From: Tim Rycroft <email@hidden>)
 >Re: Help with applescript creating folders (From: Michelle Steiner <email@hidden>)
 >Re: Help with applescript creating folders (From: "Mark J. Reed" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.