1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
on menu_click(mList)
local appName, car, cdr
if mList's length < 3 then error "Menu list is not long enough"
set {appName, car} to (items 1 thru 2 of mList)
set cdr to (items 3 thru end of mList)
tell app "System Events"
my menu_click_recurse(cdr, ((process appName)'s (menu bar 1)'s (menu bar item car)'s (menu car)))
end tell
end menu_click
on menu_click_recurse(mList, parentObject)
local car, cdr
set car to item 1 of mList
if mList's length > 1 then set cdr to (items 2 thru end of mList)
tell app "System Events"
if mList's length is 1 then
click parentObject's menu item car
else
my menu_click_recurse(cdr, (parentObject's (menu item car)'s (menu car)))
end if
end tell
end menu_click_recurse
tell app "iTunes" to activate
menu_click({"iTunes", "View", "Visualizer", "iTunes Visualizer"})
menu_click({"iTunes", "View", "Turn On Visualizer"})
menu_click({"iTunes", "View", "Full Screen"})
tell app "TextEdit" to activate
menu_click({"TextEdit", "Edit", "Speech", "Start Speaking"})
tell app "System Events"
tell ((process "TextEdit")'s (menu bar 1)'s (menu bar item "Edit")'s ¬
(menu "Edit")'s (menu item "Speech")'s (menu "Speech")) to ¬
click menu item "Stop Speaking"
end tell
tell app "System Events"
tell process "TextEdit"
tell menu bar 1
tell menu bar item "Edit"
tell menu "Edit"
tell menu item "Speech"
tell menu "Speech"
click menu item "Start Speaking"
end tell
end tell
end tell
end tell
end tell
end tell
end tell
|