• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie questions about modifying a script.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie questions about modifying a script.


  • Subject: Re: Newbie questions about modifying a script.
  • From: Yvan KOENIG <email@hidden>
  • Date: Sat, 8 Aug 2009 13:14:30 +0200


Le 7 août 2009 à 22:21, Stockly, Ed a écrit :

--Computer Name, IP Address, Domain and User Name of the Mac Work Station
set macInfo to system info
set macName to computer name of macInfo
set macIpAddress to IPv4 address of macInfo
set userName to long user name 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:"}
set macDomainName to paragraph 1 of text item 2 of networkInfo
set AppleScript's text item delimiters to {" "}


set userInfo to {}
set the end of userInfo to {"Computer Name: ", macName} as text

set the end of userInfo to {"IP Address: ", macIpAddress as text} 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 AppleScript's text item delimiters to return & return

display dialog userInfo as text
--*display alert userInfo as text


Some changes would be useful:

--Computer Name, IP Address, Domain and User Name of the Mac Work Station
set macInfo to system info
set macName to computer name of macInfo
set macIpAddress to IPv4 address of macInfo
set userName to long user name 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 {"Computer Name: ", macName} as text

set the end of userInfo to {"IP Address: ", macIpAddress as text} 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 AppleScript's text item delimiters to return & return

display dialog userInfo as text
set user_info to userInfo as text (* required to get rid of a confusion upon 'as *)
display alert user_info


Yvan KOENIG (Vallauris, FRANCE samedi 8 août 2009 13:13:35)



_______________________________________________
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
References: 
 >Re: Newbie questions about modifying a script. (From: "Stockly, Ed" <email@hidden>)

  • Prev by Date: Re: Spotlight importer for scripts
  • Next by Date: Auto: AppleScript-Users Digest, Vol 6, Issue 361
  • Previous by thread: Re: Newbie questions about modifying a script.
  • Next by thread: Re: Newbie questions about modifying a script.
  • Index(es):
    • Date
    • Thread