0

わかりました、何かを入力すると、入力した内容を含む新しいファインダー ウィンドウが表示されるスクリプトを作成しようとしています。スポットライト検索に似ていますが、スクリプト内にあります。

set theFind to text returned of (display dialog "What do you want to find?" default answer "" buttons {"Cancel", "Ok"} default button 2)
    tell application "Finder"
        reveal theFind
    end tell
4

1 に答える 1

3

あなたが求めていること(私が思うに)を正確に行うAppKitメソッドがあります:-[NSWorkspace showSearchResultsForQueryString:]、つまり、AppleScriptObjCを使用して使用できます。したがって、AppleScript エディタで、[ファイル] > [テンプレートから新規作成] > [Cocoa-AppleScript アプレット] を選択すると、次のようになります。

property NSWorkspace : class "NSWorkspace"
NSWorkspace's sharedWorkspace()'s showSearchResultsForQueryString_(theFind)

または、AppleScriptObjC をスキップして、そのメソッドが使用する非表示の Finder コマンドを使用することもできます。

tell application "Finder" to «event aevtspot» theFind
于 2013-04-11T19:04:06.140 に答える