LaunchBar Action Editor and AppleScript List Syntax
LaunchBar 6.4 introduces a new action editor:
- Easily create new actions from scratch or duplicate existing actions for customization.
- Configure action properties, runtime behavior, and more. Values are pre-filled where possible.
- Configure and modify action scripts with various scripting languages.
- Script templates provided for AppleScript, JavaScript, Python, Ruby, Shell script and Swift.
- Easily add or remove Suggestions Scripts and Action URL scripts.
- Configure script properties.
- Open scripts in default editor for editing.
- Manage action resources
- Add, rename or delete resources.
- Set image as action icon.
- Manage localization
- Add or remove localizations.
- Manage localizable strings.
There is actually quite extensive support and documentation for custom actions now, with more emphasis on sharing actions (and therefore code signing to make that secure). It’s also instructive to look at the built-in actions to see how they work.
I learned, for example, that at some point AppleScript added support for using square brackets for list literals. I do not see this documented anywhere, so I’m not sure how far back scripts with this syntax will work. But it’s nice when you have a mix of lists and records to be able to write:
[{k1:"v1", k2:[1, 2, 3]}, {k1:"v2", k2:[4, 5, 6]}]
instead of using curly brackets for everything:
{{k1:"v1", k2:{1, 2, 3}}, {k1:"v2", k2:{4, 5, 6}}}
Note that you cannot use square brackets and colons for record literals. Except in Swift, where you have to use square brackets for everything.