Last active
December 19, 2015 22:38
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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