Skip to content

Instantly share code, notes, and snippets.

@madnil
Last active December 19, 2015 22:38
Show Gist options
  • Save madnil/6028565 to your computer and use it in GitHub Desktop.
Save madnil/6028565 to your computer and use it in GitHub Desktop.
Determine your location by checking your IP address in the local area network
set theIP to do shell script "ifconfig | grep 'broadcast' | awk '{print $2}'"
try
set ip1 to first paragraph of theIP
on error
set ip1 to ""
end try
if ip1 contains "192.168.1" then
-- Location 1
else if ip1 contains "192.168.2" then
-- Location 2
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment