• 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: AppleScript and UNIX: Together at last!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript and UNIX: Together at last!


  • Subject: Re: AppleScript and UNIX: Together at last!
  • From: Chris Nebel <email@hidden>
  • Date: Sun, 25 Mar 2001 00:36:40 -0800
  • Organization: Apple Computer, Inc.

email@hidden wrote:

> Will we be able to use the command line from within scripts? Something like
>
> tell app "terminal.app"
> set x to pwd
> if x = "/users/myself" then
> cd ../
> end if
> set theFiles to ls as list
> end tell
>
> This would be awesome and incentivize my learning more Unixy stuff.

"Will" is the operative word here. There's no support for this in 10.0 --
Terminal isn't scriptable in any meaningful way, and there's no direct support
for this in AppleScript. However, it's an oft-repeated request, so it's on
our list of Things To Do. (Language nit: "incentivize" and its parent
"incent" are not words. Try "encourage" instead. Sorry, pet peeve of mine.)

In the meantime, check out this little gadget posted here about four months
ago:

> ASConsoleSend: Send commands to the console through AppleScript
> quicksend: send a console command
> quicksend list -- {something}
>
> <http://www.autographsystems.com/Wilcox/Applescript/ShellScriptor001d1.sit>
>
> *************************************
> tell application "ShellScriptor(Carbon)"
> set x to quicksend "uptime"
> end tell
>
> activate
> display dialog x
> **************************

Alternatively, you can take the inside-out approach: instead of calling Unix
things from AppleScript, call AppleScript things from Unix using the osascript
command -- see its man page for more details.


--Chris Nebel
AppleScript Engineering


  • Follow-Ups:
    • [OT]OS X Anybody got a clue how to tell iTunes to use my existing music folder?
      • From: Timothy Bates <email@hidden>
References: 
 >Re: AppleScript and UNIX: Together at last! (From: email@hidden)

  • Prev by Date: Re: CGIs with OSX
  • Next by Date: Re: Unloading Coercions
  • Previous by thread: Re: AppleScript and UNIX: Together at last!
  • Next by thread: [OT]OS X Anybody got a clue how to tell iTunes to use my existing music folder?
  • Index(es):
    • Date
    • Thread