How do you display the IP Address?
How do you display the IP Address?
- Subject: How do you display the IP Address?
- From: email@hidden
- Date: Tue, 25 Aug 2009 16:18:35 -0500
Ed,
I guess I should've looked a little
harder. When I run the modification I get an AppleScript Error further
down: sh: /usr/sbin/system_profilerSPNetworkDataType:
No such file or directory. If I remove that line I get the correct IP Address
but Network Domain: Unknown
_______________________________________________________________________________________________________
Jeffrey W. Madson |
Macintosh Systems Engineer | RR Donnelley Desktop Engineering
W6545 Quality Drive | Greenville, WI 54942
| (:
920-997-3768 |
Cell:
920-915-8619 |
*:
email@hidden
email@hidden
Sent by: applescript-users-bounces+jeffrey.madson=email@hidden
08/25/2009 04:05 PM
Please respond to
email@hidden |
|
To
| email@hidden
|
cc
|
|
Subject
| AppleScript-Users Digest, Vol 6, Issue
390 |
|
Send AppleScript-Users mailing list submissions to
email@hidden
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.apple.com/mailman/listinfo/applescript-users
or, via email, send a message with subject or body 'help' to
email@hidden
You can reach the person managing the list at
email@hidden
When replying, please edit your Subject line so it is more specific
than "Re: Contents of AppleScript-Users digest..."
Today's Topics:
1. How do you display the IP Address? (email@hidden)
2. Re: How do you display the IP Address? (Stockly, Ed)
----------------------------------------------------------------------
Message: 1
Date: Tue, 25 Aug 2009 15:57:02 -0500
From: email@hidden
Subject: How do you display the IP Address?
To: email@hidden
Message-ID:
<email@hidden>
Content-Type: text/plain; charset="us-ascii"
I am so close to having this work, I think. I'm back with latest version
of the "Help Desk Script" and need some input. I added running
a shell
script command which does return the correct IP address in Terminal or
AppleScript if ran by itself. The question is how to I identify the answer
and display it with the other values? Thanks for all the great input on
this!
set macInfo to system info
set macName to computer name of macInfo
do shell script "ipconfig getifaddr en0"
set userName to long user name of macInfo
set userlocale to user locale of macInfo
set homeDirectory to home directory of macInfo
set bootvolume to boot volume of macInfo
set primaryEthernetAddress to primary Ethernet address of macInfo
set CPUtype to CPU type of macInfo
set CPUspeed to CPU speed of macInfo
set Physicalmemory to physical memory of macInfo
set homeDirecory to home directory of macInfo
set networkInfo to do shell script "/usr/sbin/system_profiler
SPNetworkDataType" -- get network info
set AppleScript's text item delimiters to {"Domain Name:"}
try (* get rid of unavailable domain *)
set macDomainName to paragraph 1 of text item
2 of networkInfo
on error
set macDomainName to "unknown"
end try
set AppleScript's text item delimiters to {" "}
set userInfo to {}
set the end of userInfo to {"~RRD HELP DESK INFORMATION~"}
set the end of userInfo to {"Computer Name: ", macName} as text
set the end of userInfo to {"IP Address", en0} as text
set the end of userInfo to {"Network Domain: ", macDomainName}
as text
set the end of userInfo to {"User Name: ", userName} as text
set the end of userInfo to {"User Location:", userlocale} as
text
set the end of userInfo to {"Home Directory:", homeDirectory}
as text
set the end of userInfo to {"Boot Volume:", bootvolume} as text
set the end of userInfo to {"MAC Address:", primaryEthernetAddress}
as
text
set the end of userInfo to {"CPU Type:", CPUtype} as text
set the end of userInfo to {"CPU Speed:", CPUspeed} as text
set the end of userInfo to {"Memory:", Physicalmemory} as text
set AppleScript's text item delimiters to return & return
set user_info to userInfo as text (* required to get rid of a confusion
upon 'as *)
display alert user_info
_______________________________________________________________________________________________________
Jeffrey W. Madson | Macintosh Systems Engineer | RR Donnelley Desktop
Engineering
W6545 Quality Drive | Greenville, WI 54942 | (: 920-997-3768 | Cell:
920-915-8619 | *: email@hidden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.apple.com/mailman/private/applescript-users/attachments/20090825/e0b19a73/attachment.html
------------------------------
Message: 2
Date: Tue, 25 Aug 2009 14:03:35 -0700
From: "Stockly, Ed" <email@hidden>
Subject: Re: How do you display the IP Address?
To: AppleScript Users <email@hidden>
Message-ID: <C6B99FB7.2FAD1ķemail@hidden>
Content-Type: text/plain; charset="us-ascii"
Does this work?
ES
set macInfo to system info
set macName to computer name of macInfo
set ipAddress to do shell script "ipconfig getifaddr en0"
set userName to long user name of macInfo
set userlocale to user locale of macInfo
set homeDirectory to home directory of macInfo
set bootvolume to boot volume of macInfo
set primaryEthernetAddress to primary Ethernet address of macInfo
set CPUtype to CPU type of macInfo
set CPUspeed to CPU speed of macInfo
set Physicalmemory to physical memory of macInfo
set homeDirecory to home directory of macInfo
set networkInfo to do shell script "/usr/sbin/system_profiler
SPNetworkDataType" -- get network info
set AppleScript's text item delimiters to {"Domain Name:"}
try (* get rid of unavailable domain *)
set macDomainName to paragraph 1 of text item 2 of networkInfo
on error
set macDomainName to "unknown"
end try
set AppleScript's text item delimiters to {" "}
set userInfo to {}
set the end of userInfo to {"~RRD HELP DESK INFORMATION~"}
set the end of userInfo to {"Computer Name: ", macName} as text
set the end of userInfo to {"IP Address:", ipAddress} as text
set the end of userInfo to {"Network Domain: ", macDomainName}
as text
set the end of userInfo to {"User Name: ", userName} as text
set the end of userInfo to {"User Location:", userlocale} as
text
set the end of userInfo to {"Home Directory:", homeDirectory}
as text
set the end of userInfo to {"Boot Volume:", bootvolume} as text
set the end of userInfo to {"MAC Address:", primaryEthernetAddress}
as text
set the end of userInfo to {"CPU Type:", CPUtype} as text
set the end of userInfo to {"CPU Speed:", CPUspeed} as text
set the end of userInfo to {"Memory:", Physicalmemory} as text
set AppleScript's text item delimiters to return & return
set user_info to userInfo as text (* required to get rid of a confusion
upon
'as *)
display alert user_info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.apple.com/mailman/private/applescript-users/attachments/20090825/dbaad2d8/attachment.html
------------------------------
_______________________________________________
AppleScript-Users mailing list
email@hidden
http://lists.apple.com/mailman/listinfo/applescript-users
End of AppleScript-Users Digest, Vol 6, Issue 390
*************************************************
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden