スクリプトによって Spotlightメニューが開きます。Spotlightウィンドウを開くためのキーボード ショートカットはcommand+ option+ space...
tell application "System Events" to keystroke space using {command down, option down}
更新:あなたの修正された答えを考慮して、私はあなたが望むことをする小さなスクリプトを作成しました...
set the searchText to the text returned of (display dialog "Enter the name of an item you wish to search for in Spotlight:" default answer "")
tell application "System Events"
keystroke space using {command down}
keystroke the searchText
--[1]
end tell
[1] では、次のいずれかを実行できます。
トップヒットを開く:
keystroke return using {command down}
次のカテゴリの最初の項目に選択を移動します。
keystroke (ASCII character 31) using {command down} --down arrow
選択を前のカテゴリの最初の項目に移動します。
keystroke (ASCII character 30) using {command down} --up arrow
メニュー全体の最初の項目に選択を移動します。
keystroke (ASCII character 31) using {control down}
メニュー全体の最後の項目に選択を移動します。
keystroke (ASCII character 30) using {control down}