x-espresso URL Scheme
Actions
- JavaScript Actions
- Action XML
- Snippet XML
- Localizable.strings
- JavaScript API
- Cocoa API
- x-espresso URLs
You can use the custom URL scheme x-espresso://open
to create links that will automatically open a file in Espresso and optionally select particular lines and/or ranges. This is typically most useful in plug-ins that validate or otherwise parse files, but can be used anywhere on the system that you can activate a link.
To open a file, you must include up to three query variables:
filepath
(required): the path to the file you wish to openlines
: a list of lines (or line ranges) you wish to selectranges
: a list of ranges you wish to select
For instance, to simply open a file:
x-espresso://open?filepath=/path/to/file.html
To select one or more lines list the line numbers separated by commas (,), or use a range of lines denoted with a hyphen:
x-espresso://open?filepath=/path/to/file.html&lines=4,10-15
The above example will select line 4, and lines 10-15.
Or you can select one or more specific ranges in the form "index,length" where "index" is a zero-based character count from the start of the document; multiple ranges are separated by plus signs (+):
x-espresso://open?filepath=/path/to/file.html&ranges=1,10+15,2
The above example will select ten characters starting at index 1 (the second character in the document, since it is a zero-based index), and two characters starting at index 15.
You can also mix and match line selection and ranges if you wish.