Saved scripts & .roost files
Saved scripts
script new morning # a new Roost Basic script
script new tidy --js # a new Roost Script script
script ls # your scripts (and which language each is in)
script show morning
script edit morning
script rm morningA script runs when you type its name, or with run morning. Words after the name go to the script (tidy youtube.com): see Roost Basic and Roost Script. Script names are letters, numbers, - and _, and can't be the same as a command or an alias.
The editor
- Coloured, with line numbers. Mistakes are marked on their line as you type.
- The language menu switches between Roost Basic and Roost Script.
- Ctrl S saves; Ctrl Enter runs the lines without saving; Ctrl Shift Enter (Step) asks before each command; Esc closes; Ctrl E brings it back.
- Enter keeps the indent, and goes in a step after
if,for,{and friends. - Run when Fruit Bat opens and Shortcut (Ctrl Alt + a letter; ⌘ ⌥ on Mac) are at the bottom.
Running scripts
Saved scripts run with your full set of commands. Because nobody is there to answer, commands that would ask first need --yes (or { yes: true } in Roost Script) when they run from a saved script, a shortcut or a job. When you press Run in the editor, Roost asks you instead. run tidy --step steps through a saved script.
While a script runs, Roost shows each command it runs with its line number (tidy:3 › tabs --site youtube.com). Ctrl C stops it.
Toolbar and right-click
You don't need Roost open to run a script:
- Toolbar:
script pin tidy(or On the toolbar in the editor) adds it to the toolbar's ▶ button, which lists your pinned scripts and then all the others.script unpin tidytakes it off. - Right-click: the page's right-click menu has Run Roost script › with your scripts, pinned ones first.
- Shortcut: Ctrl Alt + a letter, set in the editor.
A script run this way shows its output in Roost when you next open it, and a note says it ran.
.roost files
A script can live in a .roost file, to share it or keep a copy. The file is the script's text: Roost Script files start with // roost script.
script export tidy # saves tidy.roost (asks where; Downloads by default)
script open # pick a .roost file to openOpening a .roost file
Double-click it (Fruit Bat registers the .roost extension on Windows, macOS and Linux), drop it on a page in Fruit Bat, paste its path into the address bar, open it from Downloads, or use script open.
Opening a file never runs it straight away. Roost shows it, numbered, marks the lines that change things, and asks:
📄 tidy.roost — a Roost Basic script from a file
C:\Users\you\Downloads\tidy.roost
1 # close duplicates
2 tabs --dupes | close changes things
1 line changes things. It runs with the rules for outside scripts…
Run tidy.roost? [y = run, e = edit, N = cancel]A file can come from anyone, so it runs with the rules for outside scripts: the same commands Echo can use, no --yes, every command checked again as it runs, at most 30 new tabs and 100 clicks, and 500 lines. If a line isn't allowed, Roost won't run the file, but e still opens it in the editor. Saving it from the editor makes it your own script, with every command.
Aliases
alias yt = tabs --site youtube.com
yt | mute
alias # list them
unalias ytWords after an alias go on the end: alias o = open then o github.com.