• 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: Capturing output from the command line in a AppleScript dialog box
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Capturing output from the command line in a AppleScript dialog box


  • Subject: Re: Capturing output from the command line in a AppleScript dialog box
  • From: Axel Luttgens <email@hidden>
  • Date: Tue, 30 Sep 2008 17:47:32 +0200

Le 30 sept. 08 à 17:35, Stranathan, Dan a écrit :

Im looking for a tip on how to leverage the Apple "scselect" command line tool to to show the current location in an AppleScript dialog box. Basically, I want to have a AppleScript run as a logout item, so that it can remind users what location set they are currently using, and then ask them if they would like to change the location before logging out or rebooting. I have most of the script running already, but I havent been able to figure out how to capture the output from the "scselect"t command and display it in the AppleScript dialog box. This feature is a matter convenience, since the user can always just manually look at the location set under the Apple menu or in the Network Pref pane (which I eventually take the user to it anyway - assuming they want to change locations)

Outline:

User logs out and the script starts
User is prompted with a dialog that shows the current location (from the "scselect" command) and asks the user if they want to change it.
If NO, then the AppleScript simply quits and the user logs out or reboots
If YES, then the user is taken to the Network system pref pane where they can manually pick a location from the drop-down menu.
User logs out or reboots

Hello Dan,

Here (10.5.5), scselect writes its output to stderr and even exits with a non-zero return code.
So, something like this


	do shell script "scselect 2>&1; exit 0"

is needed to get the command's output in an AS script.

HTH,
Axel _______________________________________________
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: 
 >Capturing output from the command line in a AppleScript dialog box (From: "Stranathan, Dan" <email@hidden>)

  • Prev by Date: Capturing output from the command line in a AppleScript dialog box
  • Next by Date: Problem Scripting the Script Editor
  • Previous by thread: Capturing output from the command line in a AppleScript dialog box
  • Next by thread: Re: Capturing output from the command line in a AppleScript dialog box
  • Index(es):
    • Date
    • Thread