2. There are two fundamental types of runnable file: "text filters", which accept the selection range (or entire document, if no selection) as input, and which return text that replaces the selection range (or document); and "scripts", which do neither. In unix-y terms, text filters accept the selection range on STDIN, and STDOUT replaces the selection range.
3. The arrangement in the Application Support/BBEdit folder is as follows:
- Scripts: contains executable Unix files, AppleScript files, text factories, and Automator workflows. These are run simply by loading the item and calling it directly, without providing any inputs. (Naturally, AppleScript scripts and Automator actions can query the application, and #! scripts have some information passed to `argc` and `argv` as usual.)
- Text Filters: contains the same type of items as Scripts, but when chosen, the selected text (or front document contents, if there is no selection) is passed as `argv` to Unix executables, as a string to text factories, as a reference to a `RunFromBBEdit` entry point in AppleScripts, as text input to Automator workflows, and as a source to text factories.
If an AppleScript script does not have a `RunFromBBEdit` entry point, BBEdit will call its run handler, again passing a reference to the current selection range. AppleScript scripts and Automator workflows are expected to return a string which will replace the selection range; #! scripts should write to `STDOUT`, and the text processed by a text factory will replace the selection range.
Thus, both folders can contain identical items, but how an item is invoked, and the effect that it has on the front document, will depend solely on which folder it lives in at the time of invocation.
4. The menu arrangement is as follows: the Scripts menu (and palette) contains all eligible items from the Scripts folder. The "Unix Scripts" and "Unix Filters" items have been removed from the #! menu (and their palettes from the Window menu). The Text Factories menu has been removed. The "Apply Text Factory" commands on the Text menu are renamed to "Apply Text Filter", and are now at the top of the Text menu. The "Apply Text Filter" submenu shows all eligible items contained in the Text Filters folder.