• 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: email@hidden
  • Date: Mon, 10 Aug 2009 13:39:31 -0500

Ed,

Take whatever you want, you wrote it. I intend on making a custom icon and putting it into the dock for those support calls from users that don't have the time or knowledge to look it up. The script does one odd thing, it displays another window with the same information when you select the OK button. Is there a way to have it only display the OK button and when you select it just close the application? I don't see anywhere in the script where it describes the button layout like some of the simple one's I've written.

Otherwise the script works perfectly including giving me the IP address and correct domain name. As Peter Baxter pointed out I will be running this on a variety of different Macs but I didn't understand his reference to using some "error catching" in the script. I've tested on three different models so far and it worked perfectly.
 
_______________________________________________________________________________________________________
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
 



"Stockly, Ed" <email@hidden>

08/07/2009 03:21 PM

To
AppleScript Users <email@hidden>
cc
<email@hidden>
Subject
Re: Newbie questions about modifying a script.





Jeffrey,

This script sounds like a really good idea. I may steal it from you : )

Your post touches on several issues that are fairly easy to deal with. (*It also revealed a bug that was new to me!)

First, the Mac OS isn’t really designed to display windows with info on the desktop.  Applications do that and several are available, including Text Edit which should be on any mac.  However, for your purposes, I ‘m thinking that an  applescript dialog will do the trick.

Next, many of the items you’re using shell scripting for are available to plain vanilla applescript with no additional parsing needed.

Third, I couldn’t get the url for checking IP addresses to work. Ideally you should be able to use whatever shell that works in the terminal to work in your script, but that’s something for you orsomeone else to work with.

Lastly, I suggest text item delimiters to parse the results of your shell scripts.

So here’s an example that does about 90% of what you want and should point you in the right direction for the rest.


--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


HTH,


ES

*Is this a bug?  If you uncomment that last line, it generates an error.  It shouldn’t.



On 08/07/09 11:03 AM, "
email@hidden"  wrote:

Good Afternoon,

I am totally new to AppleScript and need some assistance/advice on a script I'm trying to develop. I want to end up with a Application in the Dock or Menu Bar Item that will display the Computer Name, IP Address, Domain and User Name of the Mac Work Station in a window on the desktop.  

 _______________________________________________
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

  • Follow-Ups:
    • Re: Newbie questions about modifying a script.
      • From: "Stockly, Ed" <email@hidden>
    • Re: Newbie questions about modifying a script.
      • From: Dennis Cox <email@hidden>
References: 
 >Newbie questions about modifying a script. (From: email@hidden)
 >Re: Newbie questions about modifying a script. (From: "Stockly, Ed" <email@hidden>)

  • Prev by Date: Re: Need help with a Word script
  • Next by Date: Auto: AppleScript-Users Digest, Vol 6, Issue 363
  • Previous by thread: Re: Newbie questions about modifying a script.
  • Next by thread: Re: Newbie questions about modifying a script.
  • Index(es):
    • Date
    • Thread