I’m working on a program ( Just for MAC ) that has to run some Javascripts, do it with Applescript I know but would like to know how to run natively with these Javascripts XOJO, something like “executejavascript” that works with Web Applications.
You can use an HTMLViewer to run your JS code, but there are some limits… If you have MBS I believe that overcomes most (if not all) of the short comings of the built-in HTMLViewer… (I do not use MBS, just remember reading about it)
You can use HTML Viewer in a desktop App and can start JavaScript function in OnLoad. You can use the return value of your JavaScript then write this in title for example and use TitleChanged Event in Xojo. That it relly hacky and complex way. ;-). But that is possible,
Without Xojo you can take a look for Tide or other Frameworks. I don’t test this deeper. Perhaps you found a way with Xojo. Or Nodes.js? Perhaps oversized but I hear give it bridges to many language (.Net, T-SQL and i don’t know what else.) Perhaps the other way is possible for get values from Nodes.js ;-). Good luck.
And I think that is possible to use JavaScript instead AppleScript on Mac OS X. The Architecture supports that or supported that. I mean for a few years in every case JavaScript supported instead of AppleScript. I don’t know this works actually. Look like this:
You can do lots of interesting things just using the built-in HTMLViewer to do all your JavaScript… The one limitation that still bothers me is the lack of getting return data from the JavaScript, but you can always use either the document.title or window.status hacks to get data back to Xojo… I personally use document.title as the name of my “event” and window.status to handle the data back from JavaScript (window.status can handle lots of data whereas document.title is limited to the amount of data)… You can also use the MBS plugins to handle JavaScript returns as well…
As always, use the WebKit renderer so you get the same results cross-platform (yes, it adds to the bulk of the Windows app, but it is worth it)…