Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- tell application "System Events"
- tell process "Messages"
- tell menu bar 1
- tell menu bar item "Messages"
- tell menu "Messages"
- tell menu item "My Status"
- tell menu "My Status"
- if IPHONE is not equal to "0" then
- click menu item "Available"
- else
- click menu item "Away"
- end if
- end tell
- end tell
- end tell
- end tell
- end tell
- end tell
- end tell
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
- <plist version="1.0">
- <dict>
- <key>Label</key>
- <string>com.your-username.checkiphone</string>
- <key>ProgramArguments</key>
- <array>
- <string>/usr/bin/osascript</string>
- <string>/Users/your-username/bin/check-iphone-available.scpt</string>
- </array>
- <key>Nice</key>
- <integer>1</integer>
- <key>StartInterval</key>
- <integer>60</integer>
- <key>RunAtLoad</key>
- <true/>
- <key>StandardErrorPath</key>
- <string>/tmp/com.your-username.checkiphone-available.err</string>
- <key>StandardOutPath</key>
- <string>/tmp/com.your-username.checkiphone-available.out</string>
- </dict>
- </plist>
- launchctl load com.your-username.checkiphone.plist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement