Skip to content

Commit

Permalink
click_menu_extra()を追加(例:click_menu_extra("AppleScript/Script Editor S…
Browse files Browse the repository at this point in the history
…cripts/About these scripts..."))
  • Loading branch information
zarigani committed Jan 16, 2010
1 parent b628e2f commit 99fd984
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
Binary file modified _gui.scpt
Binary file not shown.
29 changes: 25 additions & 4 deletions _gui.txt
Expand Up @@ -94,19 +94,40 @@ on click_menu(app_name, menu_path)
tell application "System Events"
tell process app_name
set frontmost to true
click (menu bar 1's menu bar item (my number_from(mp's item 1)))

menu bar 1's menu bar item (my number_from(mp's item 1))
click result
repeat with i from 2 to mp's length
result's menu 1's menu item (my number_from(mp's item i))
click result
click (result's menu 1's menu item (my number_from(mp's item i)))
end repeat

delay 0.1 --連続してメニューを操作する時、ひと呼吸必要
end tell
end tell
end click_menu

--アイコンメニュー(ステータスメニュー)を通常のパスで指定できるようになった
--click_menu_extra("AppleScript/Script Editor Scripts/About these scripts...")
--click_menu_extra({"AppleScript", "Script Editor Scripts", "About these scripts..."})
on click_menu_extra(menu_path)
if menu_path is "" then
error "menu_path が入力されていません。"
end if
set mp to split(menu_path, "/")

tell application "System Events"
tell process "SystemUIServer"
set frontmost to true
click (menu bar 1's first menu bar item whose attribute "AXDescription"'s value is (mp's item 1))

repeat with i from 2 to mp's length
click (result's menu 1's menu item (my number_from(mp's item i)))
end repeat

delay 0.1 --連続してメニューを操作する時、ひと呼吸必要
end tell
end tell
end click_menu_extra

--shortcut(app_name, key_text)
--キーボードショートカット操作をシンプルに実行する
--引数のkey_textには、ハイフンで区切った文字列、もしくはリストで指定する
Expand Down

0 comments on commit 99fd984

Please sign in to comment.