• 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: Really dumb question . . .
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Really dumb question . . .


  • Subject: Re: Really dumb question . . .
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 26 Jul 2005 00:32:21 -0700

On Jul 26, 2005, at 12:17 AM, Wayne Melrose wrote:

On Jul 26, 2005, at 8:58 AM, Christopher Nebel wrote:

[H]ow, when a script is running under osascript, can I write to standard output? log() doesn't seem to send things anywhere from osascript.... I know that the return value of the on run handler is automatically echoed, but I'm looking for a way to report progress along the way, not just output a big string all at the end.


Oh, and just in case it's not clear, 'do shell script "echo ..." ' is not really what I'm looking for. Holy overkill. :)

Heh. Well, if you rule that out, then no, there's no built-in way. Realize that AppleScript grew up in a world where the idea of "standard output" was meaningless. There's an enhancement request on this, as well as making "log" go to stderr, but feel free to write your own. It's useful to have actual use cases instead of just "it seems like this would be handy."

So when you say "write your own" ... how would you you go about doing this?

I meant "write your own enhancement request" -- to do so, you'd go to <http://bugreport.apple.com>. You'll need an ADC membership to use it, but you can get one for free.


It is certainly possible -- and not even all that hard, assuming you're comfortable in C -- to write your own scripting addition that would spit text to stdout; see <http://developer.apple.com/technotes/ tn/tn1164.html> for details and sample code. (This sort of thing makes it harder to give your scripts to other people, though.)

Because I have asked the same question here (in a different way) but essentially I would also like to know how to log the same data that comes from the "Event Log" for some scripts.

That depends on which event log data you're talking about. If you're referring to the output of explicit "log" statements, then again you could write your own scripting addition. (Not as convenient as "log" doing the right thing, but it would work.) If you're referring to the implicit logging of commands, then that's harder. You can fake it by turning on the Apple Event Manager's internal logging (see <http://developer.apple.com/technotes/tn2004/tn2124.html#SECAE>), but the output will be, shall we say, comparatively verbose.



--Chris Nebel AppleScript and Automator Engineering

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Really dumb question . . . (From: "Mark J. Reed" <email@hidden>)
 >Re: Really dumb question . . . (From: "Mark J. Reed" <email@hidden>)
 >Re: Really dumb question . . . (From: Christopher Nebel <email@hidden>)
 >Re: Really dumb question . . . (From: Wayne Melrose <email@hidden>)

  • Prev by Date: Re: Really dumb question . . .
  • Next by Date: Re: Way to get functionality of C's 'continue' or HC 'next repeat' without using if construct?
  • Previous by thread: Re: Really dumb question . . .
  • Next by thread: Re: Really dumb question . . .
  • Index(es):
    • Date
    • Thread