LNS Home
JavaScript OSA
JavaScript OSA Home
Download & Installation
QuickStart
Project Status
Documentation
 
Object Reference
 
Core
MacOS
MacOS.AEDesc
MacOS.AEApp
MacOS.AEClass
MacOS.AEColl
MacOS.FileSpec
MacOS.OSA
MacOS.MacOSError
Sending Raw AppleEvents
Responding to AppleEvents
AppleEvent to JavaScript Value Conversion
How-Tos
 
Open Handler
Folder Actions Handlers
Write Some Text
Calling JavaScript from REALbasic
Using JavaScript Libraries
FAQ
Mailing List
JavaScript Language Documentation & Links
Products
x Script Debugger 4.5
Site Contents
bullet Mark’s Blog
Product Registration
Bug Reporting
x Freeware
Contacting Us

Using JavaScript OSA From REALbasic

REALbasic is a Rapid Appliction Development environment that uses the BASIC programming language. This page describes how to use JavaScript OSA from REALbasic.

Using JavaScript from REALbasic is almost identical to using AppleScript. To imbed a simple script into a real basic project, do the following:

  1. create a JavaScript script using any OSA script editor and save it as a compiled script file
  2. import the compiled script file into your REALbasic project
  3. invoke the script from BASIC using the following syntax: scriptName()

Passing parameters to JavaScript code is a little more complicated. Firstly you have to declare an AppleEvent handler in your JavaScript code that handles the AppleEvent REALbasic sends.

Save this script as a compiled script and import it into your REALbasic project. Once this is done, you can invoke the handler in the following way:

Thats it! Note that as with AppleScript, REALbasic converts the result of the script to a string, so you may want to do that conversion within your JavaScript code before returning to REALbasic.

 


Copyright © 1998-2009 Late Night Software Ltd. - All Rights Reserved.