Rx Editor is a script editor with a interactive interpreter (REPL). Rx is also a dialect of AppleScript expressed in JavaScript that should be easier and more familiar than the Apple JS binding.
AppleScript drives me crazy. It isn’t interactive like every other scripting language. It is too verbose (and that’s coming from someone that loves ObjC). Worst of all, it isn’t discoverable.
At some point Apple attempted to fix AppleScript by providing JavaScript bindings. Unfortunately, the JS bindings don’t make scripting much better. The Apple provided JS bindings suffer from all the afflictions of AppleScript, but with a vaguely JS feel.
Rx Editor is my attempt to make scripting suck less.
- JavaScriptCore with the ObjC API requires macOS 10.9
- XPC requires macOS 10.8
NSXMLDocumentXInclude
requires macOS 10.12- ScriptingBridge requires macOS 10.5
- OSAKit some requires macOS 10.6, some macOS 10.10
stringByApplyingTransform:reverse:
requires macOS 10.11
The minimum macOS version supported is therefore macOS 10.12 because
of the use of NSXMLDocumentXInclude
.
Mostly reference materials I fing myself needing as I develop Rx.
- OSAKit/OSAKit.h
- ScriptingBridge/ScriptingBridge.h
- Foundation/NSAppleEventDescriptor.h
- Foundation/NSAppleEventManager.h
- Foundation/NSAppleScript.h
- Foundation/NSObjectScripting.h
- Foundation/NSUserScriptTask.h
- Foundation/NSScriptSuiteRegistry.h
- Foundation/NSScriptClassDescription.h
- Foundation/NSScriptCoercionHandler.h
- Foundation/NSScriptCommand.h
- Foundation/NSScriptCommandDescription.h
- Foundation/NSScriptExecutionContext.h
- Foundation/NSScriptKeyValueCoding.h
- Foundation/NSScriptObjectSpecifiers.h
- Foundation/NSScriptStandardSuiteCommands.h
- Foundation/NSScriptSuiteRegistry.h
- Foundation/NSScriptWhoseTests.h
- CoreServices/AE/AE.h
- Carbon/OpenScripting/OpenScripting.h
- Carbon/HIToolbox/AEInteraction.h
- AppKit/NSAppleScriptExtensions.h
- AppKit/NSApplicationScripting.h
- AppKit/NSDocumentScripting.h
- AppKit/NSTextStorageScripting.h
- AppKit/NSWindowScripting.h
- AppleScriptKit/ASKPluginObject.h
- AppleScriptObjC/AppleScriptObjC.h
- Enabling Scripting of Other Apps
- NSAppleEventsUsageDescription
- ObjC Type Encodings
- Property Declarations & Encodings
Objective-C type | JavaScript type | AppleScript type |
---|---|---|
nil | undefined | null |
NSNull | null | missing value |
NSString | string | text |
long | number | integer |
long long | number | double integer |
double | number | real |
NSNumber | number, boolean | integer, real, number, boolean |
NSNumber (BOOL) | boolean | boolean |
NSNumber (OSType) | number | type |
NSDictionary | Object object | record |
NSArray | Array object | list |
NSDate | Date object | date |
NSBlock (1) | Function object (1) | script |
id (2) | Wrapper object (2) | any |
Class (3) | Constructor object (3) | |
CGPoint | { x: #, y: # } | point |
NSRange | { location: #, length: # } | |
CGRect | { x: #, y: #, width: #, height: # } | rectangle |
CGSize | { width: #, height: # } |
- [ ] any
- [X] text
- [X] integer
- [X] real
- [X] number
- [X] boolean
- [ ] specifier, reference
- [ ] location specifier
- [X] record
- [X] date
- [ ] file, alias
- [X] point
- [X] rectangle
- [X] type
- [ ] missing value
- or the name of a class, enumeration, record-type, or value-type defined elsewhere in the sdef
- To specify a complex type such as “list of integer” or “number or
text”, use a type element
<type type="integer" list="yes"/>
, or
<property name="frequency">
<type type="number"/>
<type type="text"/>
</property>
What is a specifier? It’s an unevaluated path to an object.