2013-07-02 2 views
1

작업 폴더를 만드는 데 사용하는 AppleScript가 있습니다. Applescript는 프로젝트 이름과 폴더가 저장 될 위치를 묻습니다. 작업 이름과 폴더 위치를 입력하면 스크립트는 주 폴더와 네 개의 하위 폴더를 만듭니다.폴더 만들기 AppleScript로

이제 스크립트에 현재 하위 폴더 중 하나에 번호가 매겨진 하위 폴더를 만들고 사용자에게 몇 개의 폴더를 만들지 묻는 메시지가 표시되도록하고 싶습니다. 그게 가능하니?

tell application "Finder" 
    set JobName to text returned of (display dialog "Please enter Job Name:" default answer "Job_Name") 
    set loc to choose folder "Choose Parent Folder Location" 
    set newfoldername to JobName 
    set newfo to make new folder at loc with properties {name:newfoldername} 
    make new folder at newfo with properties {name:"Job Materials"} 
    make new folder at newfo with properties {name:"Previews"} 
    make new folder at newfo with properties {name:"PSDs"} 
    make new folder at newfo with properties {name:"VX"} 
end tell 

답변

3
set JobName to text returned of (display dialog "Please enter Job Name:" default answer "Job_Name") 
set loc to choose folder "Choose Parent Folder Location" 

tell application "Finder" 
    set newfo to make new folder at loc with properties {name:JobName} 
    make new folder at newfo with properties {name:"Job Materials"} 
    make new folder at newfo with properties {name:"Previews"} 
    set targetFolder to make new folder at newfo with properties {name:"PSDs"} 
    make new folder at newfo with properties {name:"VX"} 
end tell 

repeat 
    set subCount to text returned of (display dialog "How many subfolders?" default answer 3) 
    try 
     if subCount ≠ "" then 
      subCount as integer 
      exit repeat 
     end if 
    end try 
end repeat 

repeat with i from 1 to subCount 
    tell application "Finder" to make new folder at targetFolder with properties {name:"Subfolder " & i} 
end repeat