Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  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"
  3. tell process "Messages"
  4. tell menu bar 1
  5. tell menu bar item "Messages"
  6. tell menu "Messages"
  7. tell menu item "My Status"
  8. tell menu "My Status"
  9. if IPHONE is not equal to "0" then
  10. click menu item "Available"
  11. else
  12. click menu item "Away"
  13. end if
  14. end tell
  15. end tell
  16. end tell
  17. end tell
  18. end tell
  19. end tell
  20. end tell
  21.  
  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">
  24. <plist version="1.0">
  25. <dict>
  26. <key>Label</key>
  27. <string>com.your-username.checkiphone</string>
  28.  
  29. <key>ProgramArguments</key>
  30. <array>
  31. <string>/usr/bin/osascript</string>
  32. <string>/Users/your-username/bin/check-iphone-available.scpt</string>
  33. </array>
  34.  
  35. <key>Nice</key>
  36. <integer>1</integer>
  37.  
  38. <key>StartInterval</key>
  39. <integer>60</integer>
  40.  
  41. <key>RunAtLoad</key>
  42. <true/>
  43.  
  44. <key>StandardErrorPath</key>
  45. <string>/tmp/com.your-username.checkiphone-available.err</string>
  46.  
  47. <key>StandardOutPath</key>
  48. <string>/tmp/com.your-username.checkiphone-available.out</string>
  49. </dict>
  50. </plist>
  51.  
  52. launchctl load com.your-username.checkiphone.plist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement