2012-11-02 279 views
1

Filemaker有能力使用AppleScript。如何使用AppleScript創建文件夾(包含子文件夾)

從Filemaker內部我想創建一個新的文件夾(名稱爲FileMaker字段),其中包含6個子文件夾。

我是一個完整的noob,它涉及到Applescript。

這是我的腳本至今:

tell application "FileMaker Pro Advanced" 
set folder_name to cell "FolderName" of current record 
end tell 
tell application "Finder" 
    activate 
    make new folder at folder "Desktop" of folder "dick" of folder "Users" of startup disk with properties {name:folder_name} 
end tell 
tell application "Finder" 
    activate 
     make new folder at folder {name:folder_name} of folder "Desktop" of folder "dick" of folder "Users" of startup disk with properties {name:"subfolder"} 
end tell 

我的問題是: 「Subfolder1」 的創作

什麼是我的錯嗎?

幫助深表感謝

回答

2

當箱子一個新的文件夾,您可以定義各種屬性,但指的文件夾時,只要使用的名稱,例如:

make new folder at folder folder_name of folder "Desktop" of folder "dick" of folder "Users" of startup disk with properties {name:"subfolder"} 

注意,返回結果從製作一個新的文件夾到該文件夾​​的引用,所以你也可以這樣做:

tell application "Finder" 

    set newFolder to (make new folder at folder "Desktop" of folder "dick" of folder "Users" of startup disk with properties {name:folder_name}) 

    make new folder at newFolder with properties {name:"subfolder"} 

end tell 
1

這裏是另一種方法:

set myPath to POSIX path of ((path to desktop as text) & folder_name & ":subfolder") 
do shell script "mkdir -p " & myPath 
相關問題