2011-11-14 5 views

答えて

1

Shane StanleyのPDFブックAppleScriptObjC Exploredは、AppleScriptObjCチュートリアルを入手するためのものです.Appleのほとんどの例は、既存のObjCのドキュメントにあり、変換する必要があります。

あり、あなたのアクションのインターフェイスで使用できるAutomatorのパスポップアップボタンがあるが、基本的なオープンパネルは、(それは、独自のペン先を必要としません)、次のようなものだ:

set defaultDirectory to POSIX path of (path to desktop) -- a place to start 

tell current application's NSOpenPanel's openPanel() 
    setFloatingPanel_(true) 
    setTitle_("Panel Test") 
    setPrompt_("Choose") -- the button name 
    setMessage_("Choose some stuff:") 
    setDirectoryURL_(current application's NSURL's URLWithString_(defaultDirectory)) 

    setCanChooseFiles_(true) 
    setCanChooseDirectories_(true) 
    setShowsHiddenFiles_(false) 
    setTreatsFilePackagesAsDirectories_(false) 
    setAllowsMultipleSelection_(true) 

    set theResult to it's runModal() as integer -- show the panel 
    if theResult is current application's NSFileHandlingPanelCancelButton then quit -- cancel button 
    set theFiles to URLs() as list --> a list of NSURLs 
end tell 

注意AppleScriptエディタを使用している場合は、エディタから直接AppleScriptObjCコードを実行できないため、Cocoa-AppleScriptアプレットで実行する必要があります。しかし、エディタから使用できるASObjC Runnerバックグラウンドアプリケーション(Stanley氏も同様)があります。

関連する問題