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
Affrus 1.0
x FaceSpan 4.3
Script Debugger 4.0
Site Contents
Home Page
bullet Mark’s Blog
Product Registration
Bug Reporting
x Freeware
Contacting Us

Project Status

The current stable release of JavaScript OSA is 2.0.1.

Release History

JavaScript OSA 2.0.1

JavaScript OSA 2.0 is part of the Script Debugger 4.0 project. The objective is to modernize JavaScript OSA for Mac OS X and to address some of the problems and suggestions that have been made through the JavaScript OSA mailing list.

The move away from the Classic Mac OS has allowed me to use the Mozilla JavaScript engine totally unmodified. I have also been able to shed allot of Classic Toolbox code. This will mean that I can adopt new Mozilla JavaScript releases much more easily.

Core Changes

  • Uses a new C++ OSA component framework (as used by Script Debugger 4's Script Debugger.component)
  • Uses Mozilla JavaScript (SpiderMonkey) 1.5 rc6a
  • No longer supports the Classic Mac OS
  • Packaged as Mach-O Bundle
  • All Classic Mac OS stuff has been removed (FSSpec usage, etc.)
  • Improved Unicode support
  • Reinstated of Core.XML object (missing in JavaScript OSA 2.0a1)
  • Fixed code loading problems which prevented JavaScript OSA 2.0a1 from opening existing scripts
  • AEDesc dates are converted to JS Date objects, and JSDate objects are converted to AEDesc LongDateTime values
  • MacOS.FileSpec objects now use CFURLs instead of FSRefs to reference a file. This allows MacOS.FileSpec to refer to files that do not yet exist as it once did on the Classic Mac OS.
  • AEDescs containing typeFileURL values are now converted to MacOS.FileSpec objects
  • MacOS.FileSpec objects are converted to typeFSRef AEDescs when possible (when the file does not exist, typeFileURL AEDesc values are created)

API Changes

  • Core object
    • version property is now always the same as the JSOSA build version
    • libVersion property added which is the version of JavaScriptLibrary.js
    • home property now refers to the user's home folder (i.e. ~) rather than the desktop
    • added desktop which is the Desktop's POSIX path
  • MacOS object
    • added appByBundleID(bundleID, loadDict) - this function compliments the various appByXXX functions by locating an application by its bundle id:

      var term = MacOS.appByBundleID("com.apple.terminal", true); // Mac OS X Terminal.app
      term.name; // read the name property


    • added appByHFSPath(hfsPath, loadDict) - this function compliments the various appByXXX functions by locating an application by its HFS path
    • added appByPath(posixPath, loadDict) - this function compliments the various appByXXX functions by locating an application by its POSIX path
    • added appByFileSpec(MacOS.FileSpec, loadDict) - this function compliments the various appByXXX functions by locating an application an instance of MacOS.FileSpec
    • MacOS.version() is now a property (rather than a function) to match Core.version
    • added homeFolder property which is the user's ~ FileSpec
    • added documentsFolder property which is the user's ~/Documents FileSpec
    • added musicFolder property which is the user's ~/Music FileSpec
    • added moviesFolder property which is the user's ~/Movies FileSpec
    • added picturesFolder property which is the user's ~/Pictures FileSpec
    • added documentsFolder property which is the user's ~/Documents FileSpec
    • added sitesFolder property which is the user's ~/Sites FileSpec
    • added sharedFolder property which is the user's ~/Shared FileSpec
    • added publicFolder property which is the user's ~/Public FileSpec
  • MacOS.FileSpec object
    • added displayName property (read only) - returns file's name as displayed in the Finder (possibly with extension removed)
    • added path property (read/write) - fileSpec's POSIX path
    • added HFSpath property (read/write) - fileSpec's HFS path
    • added valid property (read/only) returns true if the FileSpec refers to a file that exists
    • added items property (read only) returns an array of the items within a folder
    • constructor can now be called with no parameters, facilitating a later setting of HFSpath property
    • added fileRef property (read/only) returns typeFSRef AEDesc
    • added fileURL property (read/only) returns typeFileURL AEDesc
  • MacOS.OSA object
    • compile-time & run-time errors are now catchable as JavaScript exceptions (-1753 - errOSAScriptError)
    • added _error, _errMessage, _errorBriefMessage, _errorOffendingObject, _errorPartialResult, _errorApplication, _errorExpectedType, _errorStart and _errorEnd properties to get details of the actual error
    • _modified and _dictionary properties are now readable
    • removed Frontier constant as the Frontier OSA component does not exist on Mac OS X
  • MacOS.AEOMClass object
    • the valueOf(desiredType, [convert]) function accepts an optional second bool parameter: true = convert value to a JavaScript value, false = return value as a MacOS.AEDesc instance
    • propertyAs() functions accept an optional second bool parameter: true = convert value to a JavaScript value, false = return value as a MacOS.AEDesc instance
  • MacOS.AEOMApplication object
    • applications are automatically launched as needed if loadDict is true
    • renamed _path property to _file
    • added _running property - returns true if the app is running
    • added _signature property - returns the app's signature
    • added _bundleID property - returns the app's bundleID string
    • added _foreground property - returns type if the app is the foreground app
    • added activate() function - activates or launches the app
    • added launch(inForeground) function - launches the app, returns true if launched and false if already running
  • MacOS.MacOSError object
    • added name property - returns error short name (e.g. fnfErr, procNotFound)
    • added new Mac OS X error message string

1.0.3 - March 11, 2002

  • Addressed an intermittent problem where the JavaScript OSA component would fail to load on Mac OS X systems
  • Added a store() method to the MacOS.OSA object
  • JavaScript OSA now properly accepts float and Fixed values appearing in AppleEvents
  • Added _vbnames property to AEOMApplication class that creates VisualBasic compatible identifiers when loading application dictionaries.

1.0.2 - March 11, 2002 - Withdrawn

1.0.1 - October 11, 2001

  • Supports Unicode strings arriving in AppleEvents
  • New FileMaker Pro 5 example script
  • Included with Script Debugger 3.0.1

1.0 - September 25, 2001

 

 


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