SHOW:
|
|
- or go back to the newest paste.
1 | - | set IPHONE to do shell script "if /usr/local/bin/arp-scan -l | grep your-iphone-mac; then echo 1; else echo 0; fi" user name "your-username" password "your-password" with administrator privileges |
1 | + | set IPHONE to do shell script "if /usr/local/bin/arp-scan -l | grep your-iphone-mac; then echo 1; else echo 0; fi" user name "your-username" password "your-password" with administrator privileges |
2 | - | tell application "System Events" |
2 | + | tell application "System Events" |
3 | - | tell process "Messages" |
3 | + | tell process "Messages" |
4 | - | tell menu bar 1 |
4 | + | tell menu bar 1 |
5 | - | tell menu bar item "Messages" |
5 | + | tell menu bar item "Messages" |
6 | - | tell menu "Messages" |
6 | + | tell menu "Messages" |
7 | - | tell menu item "My Status" |
7 | + | tell menu item "My Status" |
8 | - | tell menu "My Status" |
8 | + | tell menu "My Status" |
9 | - | if IPHONE is not equal to "0" then |
9 | + | if IPHONE is not equal to "0" then |
10 | - | click menu item "Available" |
10 | + | click menu item "Available" |
11 | - | else |
11 | + | else |
12 | - | click menu item "Away" |
12 | + | click menu item "Away" |
13 | - | end if |
13 | + | end if |
14 | - | end tell |
14 | + | end tell |
15 | - | end tell |
15 | + | end tell |
16 | - | end tell |
16 | + | end tell |
17 | - | end tell |
17 | + | end tell |
18 | - | end tell |
18 | + | end tell |
19 | - | end tell |
19 | + | end tell |
20 | end tell | |
21 | ||
22 | - | <?xml version="1.0" encoding="UTF-8"?> |
22 | + | <?xml version="1.0" encoding="UTF-8"?> |
23 | - | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
23 | + | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
24 | - | <plist version="1.0"> |
24 | + | <plist version="1.0"> |
25 | - | <dict> |
25 | + | <dict> |
26 | - | <key>Label</key> |
26 | + | <key>Label</key> |
27 | - | <string>com.your-username.checkiphone</string> |
27 | + | <string>com.your-username.checkiphone</string> |
28 | - | |
28 | + | |
29 | - | <key>ProgramArguments</key> |
29 | + | <key>ProgramArguments</key> |
30 | - | <array> |
30 | + | <array> |
31 | - | <string>/usr/bin/osascript</string> |
31 | + | <string>/usr/bin/osascript</string> |
32 | - | <string>/Users/your-username/bin/check-iphone-available.scpt</string> |
32 | + | <string>/Users/your-username/bin/check-iphone-available.scpt</string> |
33 | - | </array> |
33 | + | </array> |
34 | - | |
34 | + | |
35 | - | <key>Nice</key> |
35 | + | <key>Nice</key> |
36 | - | <integer>1</integer> |
36 | + | <integer>1</integer> |
37 | - | |
37 | + | |
38 | - | <key>StartInterval</key> |
38 | + | <key>StartInterval</key> |
39 | - | <integer>60</integer> |
39 | + | <integer>60</integer> |
40 | - | |
40 | + | |
41 | - | <key>RunAtLoad</key> |
41 | + | <key>RunAtLoad</key> |
42 | - | <true/> |
42 | + | <true/> |
43 | - | |
43 | + | |
44 | - | <key>StandardErrorPath</key> |
44 | + | <key>StandardErrorPath</key> |
45 | - | <string>/tmp/com.your-username.checkiphone-available.err</string> |
45 | + | <string>/tmp/com.your-username.checkiphone-available.err</string> |
46 | - | |
46 | + | |
47 | - | <key>StandardOutPath</key> |
47 | + | <key>StandardOutPath</key> |
48 | - | <string>/tmp/com.your-username.checkiphone-available.out</string> |
48 | + | <string>/tmp/com.your-username.checkiphone-available.out</string> |
49 | - | </dict> |
49 | + | </dict> |
50 | </plist> | |
51 | ||
52 | launchctl load com.your-username.checkiphone.plist |