Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to log to message window in Script Editor using JavaScript for Automation

"JavaScript for Automation" is brand new in OSX Yosemite. I am not familiar with AppleScript as I don't really like how verbose it is. But Javascript looks great! However, I can't figure out how to send debug messages to the message window of ScriptEditor! I've looked everywhere... Is this possible? What is the code to do it?

I tried:

console.log("Hello World");

But that doesn't work. Any ideas? This should be so simple!

Note: This isn't an HTML/Javascript question. I am talking about the App called "Script Editor" in OSX using the Javascript language instead of AppleScript. I would tag this question with "Script-editor" but SO won't allow me to tag.

like image 998
Kivak Wolf Avatar asked Dec 22 '14 19:12

Kivak Wolf


1 Answers

OK Apparently it was easy enough.

this.console.log("Hello World");

I found this by simply typing this into a script and running it. It returns back GlobalObject for this with plenty of interesting properties and functions including the console property which contains a log() function.

like image 51
Kivak Wolf Avatar answered Nov 01 '22 05:11

Kivak Wolf