Re: Newbie questions about modifying a script.
Re: Newbie questions about modifying a script.
- Subject: Re: Newbie questions about modifying a script.
- From: Dennis Cox <email@hidden>
- Date: Mon, 10 Aug 2009 14:03:49 -0500
- Thread-topic: Newbie questions about modifying a script.
On 8/10/09 1:39 PM, "email@hidden" <email@hidden> wrote:
> 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 <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.
>
Instead of using the second to the last line, use the last line (remove the
--*) but put it in the form that Shane(?) mentioned earlier:
display alert (userInfo as text)
This works for me. The diff between display dialog and display alert is that
there can be no user interaction with display alert besides clicking the
"OK" button. If you look at the dictionary for Standard Additions you'll see
that there are numerous options for display dialog.
Dennis
_______________________________________________
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