0
我想實施this script(也在下面列出)作爲單獨的文件。我如何將它作爲POSIX路徑的參考?引用外部腳本文件
tell application "ASObjC Runner"
activate
set chooserResult to run the script {chooseFilesOrFolders} with response
-- the above line would have to reference something like RemoteVolume/test.scpt
end tell
引用的腳本本身存在不同的文件「test.scpt」:
script chooseFilesOrFolders
tell current application's NSOpenPanel's openPanel()
setTitle_("Choose Files or Folders") -- window title, default is "Open"
setPrompt_("Choose") -- button name, default is "Open"
setCanChooseFiles_(true)
setCanChooseDirectories_(true)
setAllowsMultipleSelection_(true) -- remove if you only want a single file/folder
get its runModal() as integer -- show the panel
if result is current application's NSFileHandlingPanelCancelButton then error number -128 -- cancelled
return URLs() as list
end tell
end script
謝謝pbell,這澄清了方法論。它與普通的香草腳本一起工作,但是我無法在「ASObjC Runner」構造中使用它......我不確定是否「使用響應運行腳本{chooseFilesOrFolders}是罪魁禍首...... – user3101259