• 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: "Stockly, Ed" <email@hidden>
  • Date: Mon, 10 Aug 2009 12:06:21 -0700
  • Thread-topic: Newbie questions about modifying a script.

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

Excellent use of the technology!

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

Jeffrey,

With appleScript you have two basic options for this kind of simple display:
display dialog and display alert.

Here¹s what the dictionary for those two commands looks like

set theResult to display dialog string ¬
     default answer string ¬
     buttons {string, ...} ¬
     default button number | string ¬
     cancel button number | string ¬
     giving up after integer

set theResult to display alert string ¬
     message string ¬
     as [critical/informational/warning] ¬
     buttons {string, ...} ¬
     default button number | string ¬
     cancel button number | string ¬
     giving up after integer

In the sample script we used both, so you should be able to choose whichever
best suits your needs. I think Display alert would be best.

By default, display alert uses a single button (³OK²) and you have the
option of using additional buttons.

So for your script I would remove the current display dialog/ display alert
lines and replace them with something like this:

display alert (userInfo as text) as informational

That should remove the second window.

>> 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.
>
If you try to run it as written on a mac that does not have a domain, then
it will generate and error.  The error trapping would look something like
this:
try
    set macDomainName to paragraph 1 of text item 2 of networkInfo
on error
    set macDomainName to "No Domain"
end try

HTH,

ES

 _______________________________________________
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: email@hidden)

  • Prev by Date: Re: Newbie questions about modifying a script.
  • Next by Date: Assigning Color Profile
  • Previous by thread: Re: Newbie questions about modifying a script.
  • Next by thread: Re: Newbie questions about modifying a script.
  • Index(es):
    • Date
    • Thread