OSDN Git Service

Regular updates
[twpd/master.git] / applescript.md
1 ---
2 title: AppleScript
3 updated: 2018-12-06
4 layout: 2017/sheet
5 category: macOS
6 prism_languages: [applescript]
7 ---
8
9 ### Running
10
11 ```applescript
12 osascript -e "..."
13 ```
14
15 ```applescript
16 display notification "X" with title "Y"
17 ```
18
19 ### Comments
20
21 ```applescript
22 -- This is a single line comment
23 ```
24
25 ```applescript
26 # This is another single line comment
27 ```
28
29 ```applescript
30 (*
31 This is
32 a multi
33 line comment
34 *)
35 ```
36
37 ### Say
38
39 ```applescript
40 -- default voice
41 say "Hi I am a Mac"
42 ```
43
44 ```applescript
45 -- specified voice
46 say "Hi I am a Mac" using "Zarvox"
47 ```
48
49 ### Beep
50
51 ```applescript
52 -- beep once
53 beep
54 ```
55
56 ```applescript
57 -- beep 10 times
58 beep 10
59 ```
60
61 ### Delay
62
63 ```applescript
64 -- delay for 5 seconds
65 delay 5
66 ```