Ah, ok..:
var Test = "Hello World";
MacOS.appSelf().do_shell_script("echo " + Test);
Seemed to do the trick. Would be nice to just have Core.Write() or
Core.Print(), but as you say - easy enough to add in via my own
function..
--- In jsosa@yahoogroups.com, Mark Alldritt <alldritt@...> wrote:
>
> Hi,
>
> > I'm running a script via terminal using:
> > osascript -lJavaScript filename.js
> >
> > but I can't seem to be able to output any text to the terminal.
> > Core.message is designed for popups (and doesnt work anyways),
print,
> > output, write, etc don't seem to work.
> >
> > Does anyone know any way to just output a line of text?
>
> The problem here is the osascript tool. There is a 'log'
AppleEvent for
> this purpose, but osascript does not seem to respond to it.
>
> Testing from AppleScript, it does not seem to work:
>
> osascript -e 'log "testing"'
>
> If this were to work, you could generate the same event from JS.
>
> Now, if you only want to display one block of text, you can return
it as the
> value of the script:
>
> osascript -lJavaScript -e '"Testing"'
>
> The only alternative I can think of is dropping down to the shell:
>
> osascript -e 'do shell script "echo testing"'
>
> Which works. So, in JSOSA this would look like:
>
> osascript -lJavaScript -e 'MacOS.appSelf().do_shell_script("echo
testing")'
>
> You can wrap this in a function and add it to the Core object and
then its
> available everywhere.
>
> Cheers
> -Mark
>
> --------------------------------------------------------------------
----
> Mark Alldritt Late Night Software Ltd.
> Phone: 250-380-1725 Script Debugger 4.0 -
AppleScript IDE
> WEB: http://www.latenightsw.com/ FaceSpan 4.3 - AppleScript RAD
> Affrus 1.0 - Perl Debugging
>