https://github.com/sillyutility/rx-editor
Alternative macOS scripting dialect and editor
https://github.com/sillyutility/rx-editor
Last synced: 8 months ago
JSON representation
Alternative macOS scripting dialect and editor
- Host: GitHub
- URL: https://github.com/sillyutility/rx-editor
- Owner: SillyUtility
- Created: 2021-01-14T18:53:04.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-11T22:27:38.000Z (almost 4 years ago)
- Last Synced: 2025-05-20T13:15:32.331Z (9 months ago)
- Language: Objective-C
- Homepage:
- Size: 15.5 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
#+TITLE: Rx Editor
#+DATE: 2021-01-14
#+STARTUP: showall
[[./assets/icon-sm.png]]
Rx Editor is a script editor with a interactive interpreter ([[https://wiki.c2.com/?ReadEvalPrintLoop][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.
* Requirements
- 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=.
* Development Notes
Mostly reference materials I fing myself needing as I develop Rx.
** Scripting headers
- 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
** Apple scripting documentation
- [[https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW25][Enabling Scripting of Other Apps]]
- [[https://developer.apple.com/documentation/bundleresources/information_property_list/nsappleeventsusagedescription?language=objc][NSAppleEventsUsageDescription]]
- [[https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html][ObjC Type Encodings]]
- [[https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtPropertyIntrospection.html#//apple_ref/doc/uid/TP40008048-CH101-SW1][Property Declarations & Encodings]]
** Scripting type equivalents
| 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: # } | |
** TODO Implemented AppleScript types
- [ ] 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 ~~, or
#+begin_src xml
#+end_src
What is a specifier? It's an unevaluated path to an object.