Skip to content

Instantly share code, notes, and snippets.

@poundbangbash
Created July 27, 2015 04:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poundbangbash/d90c54d5ff56cdeb517d to your computer and use it in GitHub Desktop.
Save poundbangbash/d90c54d5ff56cdeb517d to your computer and use it in GitHub Desktop.
Computer name code
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