FYI... Another OSA Component that works with SC

Need help with a script? This is the place to discuss how to get your code running!

FYI... Another OSA Component that works with SC

Postby Dave_Higgins » Sun Aug 08, 2010 5:03 pm

I thought some of you might find this interesting, if not useful... You know how if you run script(list), you always end up with just "AppleScript" & "Generic Scripting System" ? Well, I found one that works in SC when installed, and it's FREE...

"JavaScript OSA"

http://www.latenightsw.com/freeware/JavaScriptOSA/index.html

I've messed around with it a bit, having run through many of their methods/functions... A good deal of them still work, but since the software is old (the site still speaks of using it in Classic, as well as OS X), there are a few things broken, but not a lot. On the site there are a lot of syntax mistakes like "( )" when not needed, etc...

Not only can you run regular JavaScript through SC's script() function:
Code: Select all
get script(do, JavaScript, tJavaScript)

they also include some additional methods in categories like:
Core, MacOS, MacOS.AEDesc, MacOS.AEApp, MacOS.AEClass, MacOS.FileSpec...
Can load JavaScript libraries with Core.load(): // Untested here
var lib = Core.load(Core.home + "/Lib.js");

If you're good with JavaScript you could do some interesting stuff, many times with much less code than AppleScript. For me... It's been a long time since I messed with JavaScript, and I didn't really get it at the time. Now that I'm picking up on Obj-C and doing more with AppleScript in ASOC, even JS is making more sense to me.

I've had it installed for a few weeks/months now and haven't seen it interfere with anything else I'm doing with OSA... Strange, though, it doesn't show up in my shell using "osalang", and AppleScript Editor doesn't pick up on it, either.

I did the "Try Before You Buy" on their "Script Debugger 4.5", which really is a slick app, but I just can't justify dropping US$199 that I just don't have for it... Maybe if I had disposible income.

But, it's very cool with that installed because you get another OSA Component, called "AppleScript Debugger X" along with "JavaScript" and "AppleScript"... If you do a LOT of AppleScript stuff in SC it could be worth it... When you use:

get script(do, "AppleScript Debugger X", tScript)

The GUI app will open up in debug tracing mode so you can step through your appleScript line by line while SC politely waits for a reply (not sure about timeouts... Might have to crank up the AETimeOut in SC, although it says it's for AEs and not script() ) The app is loaded with variable watchers and various other windows and panels. Very handy, just too expensive for me at the moment.

Anyway, just thought some of you might like to know about these tools.
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: FYI... Another OSA Component that works with SC

Postby Ken Norris » Sun Aug 15, 2010 11:49 am

Thanks Dave,

That's great news for those of us who work on the web all the time! Writing JS routines we can implement from SC will give us the ability to test and install JS code into our pages.
All the best,
Ken N.
http://fhtinyradio.com/
kenn@fhtinyradio.com
User avatar
Ken Norris
 
Posts: 284
Joined: Mon Nov 03, 2008 7:27 pm

Re: FYI... Another OSA Component that works with SC

Postby marksch » Sun Aug 15, 2010 2:28 pm

Hi,

Late Night Software's JS OSA component is very old and no longer supported (IIRC that's one reason why it is free). It is nice to experiment with, but I don't think it should be used in commercial projects and production environments.

Best,

Mark
We have time for new projects. Go to my homepage to contact me.

Follow me on Facebook https://www.facebook.com/marksch
User avatar
marksch
 
Posts: 79
Joined: Fri Aug 22, 2008 4:51 am

Re: FYI... Another OSA Component that works with SC

Postby Dave_Higgins » Sun Aug 15, 2010 8:56 pm

marksch wrote:Late Night Software's JS OSA component is very old and no longer supported (IIRC that's one reason why it is free). It is nice to experiment with, but I don't think it should be used in commercial projects and production environments.

That's why I had mentioned that some of the parts don't work any more. I, too, don't think I'd want to use it in any kind of production environment. But, for little testing routines it seems like it'd be ok. Like Ken says, it can help with testing out stuff before filling in a web site's JS files.
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: FYI... Another OSA Component that works with SC

Postby sandrobilbeisi » Tue Dec 05, 2017 9:11 pm

the latest version of JavaScript OSA was updated in 2014 (just i time to be superseded by Apple's JXA)
* No relation to Late Night Software's previous former JavaScriptOSA component.
It was in fact a completely new project restart
this software is useful for versions of Mac OS X between 10.6 and 10.9 (which did not include JXA)
Mac OS X 10.10 and above include JXA (JavaScript for Automation)

this latest version is based on JavaScriptCore instead of the older bundled Mozilla Rhino JS interpreter

archive includes source code, built component and utility tool
also contains lots of OSA goodies
* AppleEventBridge (AEB) - mostly cleaned-up and modernized fork of Appscript.framework
* JavaScriptAppleEventBridge (JAB) - Apple event bridge for JavaScriptCore, built on AEB
* JavaScriptOSA (JOSA) - OSA language component for JavaScriptCore with integrated JAB support
* JABDemo - basic application for testing/comparing JAB against AppleScript's own AE support
* aebtest, jabtest, josatest - command-line executables used for ad-hoc AEB, JAB, JOSA testing

downloaded from:
https://sourceforge.net/projects/appscr ... -11-02.zip
sandrobilbeisi
 
Posts: 35
Joined: Mon Dec 04, 2017 1:11 am


Return to Scripting in SuperTalk

Who is online

Users browsing this forum: No registered users and 2 guests