Skip to content

Instantly share code, notes, and snippets.

@wata
Created April 20, 2021 06:24
Show Gist options
  • Save wata/e91530ed5bc194b93a1e842eb1b5368b to your computer and use it in GitHub Desktop.
Save wata/e91530ed5bc194b93a1e842eb1b5368b to your computer and use it in GitHub Desktop.
Siriコマンド入力するAppleScript
tell application "System Events" to tell the front menu bar of process "SystemUIServer"
tell (first menu bar item whose description is "Siri")
perform action "AXPress"
end tell
end tell
delay 1
tell application "System Events" to tell the process "NotificationCenter"
set notifyWindows to every window
repeat with notifyWindow in notifyWindows
if description of notifyWindow is "システムダイアログ" then
set elements to entire contents of notifyWindow
tell (first text field of first group of first UI element of first scroll area of notifyWindow)
set focused to true
set value to "宇多田ヒカルの曲を流して"
perform action "AXConfirm"
end tell
exit repeat
end if
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment