2012-10-30 84 views
4

我需要從AppleScript獲取所選文件夾的文件路徑。我正在使用下面的代碼來做到這一點。從AppleScript獲取文件路徑

--Display selection window 
    set source_folder to choose folder with prompt "Please select directory." 
    --Get the path of the folder 
    set item_list to get the path of every disk item of source_folder 

我收到這樣的文件路徑:

文件:路徑:至::fodler

我想要的是:

文件/路徑/要/的/文件夾

回答

3

Try:

set source_folder to choose folder with prompt "Please select directory." 

tell application "System Events" 
    set item_list to POSIX path of every disk item of source_folder 
end tell 
3

嘗試獲得了POSIX路徑,而不是:

set item_list to get the POSIX path of every disk item of source_folder