Created
July 27, 2015 04:08
-
-
Save poundbangbash/d90c54d5ff56cdeb517d to your computer and use it in GitHub Desktop.
Computer name code
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
try | |
set cpuName to (do shell script "scutil --get ComputerName") | |
set ipAddress to do shell script "ifconfig $(route get apple.com | awk '/interface/ {print $2}') | awk '/inet / {print $2}'" | |
set theResult to display dialog "Computer Name: | |
" & cpuName & " | |
IP Address: | |
" & ipAddress buttons {"Copy IP to Clipboard", "Copy Name to Clipboard", "OK"} default button 3 | |
if button returned of theResult is "Copy Name to Clipboard" then | |
set the clipboard to cpuName | |
else if button returned of theResult is "Copy IP to Clipboard" then | |
set the clipboard to ipAddress | |
end if | |
end try |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment