Skip to content

Instantly share code, notes, and snippets.

@joker1007
Created November 16, 2014 11:12
Show Gist options
  • Save joker1007/c7e116c5eb2389ebc6a0 to your computer and use it in GitHub Desktop.
Save joker1007/c7e116c5eb2389ebc6a0 to your computer and use it in GitHub Desktop.
特定のIPが割り当てられた時、NASを自動でマウントするAppleScript
global prevIpValue
set prevIpValue to ""
on idle
set newIpValue to IPv4 address of (get system info) as string
if newIpValue = "192.168.1.80" and not newIpValue = prevIpValue then
try
display alert "NASをマウントします"
do shell script "/Users/joker/bin/mount_nas.sh"
end try
end if
set prevIpValue to newIpValue
return 10 -- time in seconds to perform checking
end idle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment