PipeLine: OSCLI Script Manager
by Mark Moxon

When run the PipeLine application will install itself on the icon bar. Clicking Select or Adjust on the bar icon opens up the Command window. This contains 10 lines, and clicking on a line places the caret on that line. The cursor up key moves the caret up a line, the cursor down key moves it down a line (as does Return), and Page Up and Page Down move the caret to the top and bottom of the script respectively. Each line can hold up to 80 characters.

What these lines make up is a "shell script" of OSCLI commands. When a file or selection of files is dragged onto the PipeLine icon or into the Command window (these operations are known as dragging a file into the PipeLine), this script is passed to the Command Line Interpreter (CLI), with each occurrence of the wildcard characters (%0,%1,%2,%3 & %4) replaced by the following parts of the filename/filetype:
%0  full filename
%1  just filename
%2  file pathname
%3  hexadecimal filetype number
%4  textual filetype
The filetype numbers and textual filetype for files without a filetype between 0 and &FFF are as follows:
&1000  "Directory"
&2000  "Application"
&3000  "Load/Exec"
The "Load/Exec" type is given to files without a type but with load and execution addresses. If the hexadecimal filetype is in the range 0 to &FFF but there is no textual equivalent, then the textual filetype is set to "Undefined".

Note that the %2 wildcard (file pathname) is the name of a directory, so it does not end in a a full stop. For example, if the text file
adfs::HardDisc4.$.Files.Letter
was dragged into the PipeLine then the three wildcards would be replaced in the current script by:
%0  adfs::HardDisc4.$.Files.Letter
%1  Letter
%2  adfs::HardDisc4.$.Files
%3  FFF
%4  Text
and then the substituted script would be passed to the CLI. When a selection of files is dragged into the PipeLine, then it is the same as dragging them one at a time.

Clicking menu on the bar icon (or over the Command window) opens up the main menu, with the following entries (the first and last are only in the icon bar menu):

Info 
Displays a standard information box.

Save Script 
To save a script, type in the script name and either click on OK or press Return. Note that the script name consists of up to 10 characters; no pathname is necessary, as the scripts are always saved within the PipeLine application. Just choosing this option from the main menu without going into the submenu saves the script under the current save name (if there is one). The current Options settings (i.e. Directories and Recurse) are also saved with the script file.

Load Script 
Displays a list of all the available scripts. Choose the script to load by clicking select on its name, and the script will be loaded. If there are no saved scripts, then "(No Scripts)" is displayed as the list, which has no effect when chosen. Note that the application has to examine its internal scripts directory before this menu can be displayed, so if you have a lot of script files saved, or you are using a floppy disc drive, there may be a (very) short pause before the menu appears. The Options settings (i.e. Directories and Recurse) are also loaded from the script file.

Del Script 
Similar to Load Script, but the script chosen is deleted.

Options  Directories
Choosing this toggles a tick next to the item. When ticked, directories (and application directories) are passed through the PipeLine as well as files. This allows commands such as "Stamp" to be applied to a selection which may contain directories without an error being reported.

Options  Recurse
Choosing this toggles a tick next to the item. When ticked, if a directory is dragged into the Pipeline then the command is applied recursively to the contents of the directory. Note that the directory (and all its subdirectories) will only be operated on themselves if the Directories option is ticked, though the files contained within the directories will be operated on regardless.

Clear
Clears the 10 lines in the Command window and blanks the current save name (in the Save Script dialogue box).

Quit
Quits the application. Note that quitting without saving the current script does not produce any warning, and the script is not saved.

When a file (or selection of files) is dragged into the PipeLine, then the current script is passed to the CLI with the wildcards substituted for as explained above. Note that the current script is what is displayed in the Command window: the script does not have to be saved first.

If an error occurs during an OSCLI command execution then an error box is displayed. If OK is clicked, the next file in the selection is placed into PipeLine (if there is one), and if Cancel is clicked, the application is quit.

Any OSCLI commands can be used, including the *If construct and the redirection operators <,> and >>, so the application can be used to perform some quite powerful functions.


Examples
--------

1. Delete
This script will delete any files and directories that are dragged into the PipeLine, even if they are locked.

2. Echo
This outputs the substituted values of %0, %1, %2, %3 and %4 when anything is dragged into the PipeLine. This is useful for getting familiar with the values of the wildcard characters. It does not recurse through directories.

3. ListSubs
This outputs the subdirectories of a directory if one is dragged into the PipeLine. The search is called "depth first search" because the application will search the contents of the directory before reporting the directory itself.

4. ListText
This outputs a list of all the files with type Text contained in the subdirectories of the directory dragged into the PipeLine. The search is recursive.

5. Lock
This locks anything dragged into the PipeLine. If a directory is dragged into the PipeLine, then all its subfiles and subdirectories are locked recursively.

6. Stamp
This date stamps all files dragged into the PipeLine, recursively. Since you can't date stamp directories, the Directory option is off to avoid an error being reported.

7. Structure
This will delete any files dragged into the PipeLine, as for Delete. However, if a directory or an application is dragged into the PipeLine, then all files in the directory (and its subdirectories recursively) are deleted, but the directory structure is left intact. Again, files are deleted even if they are locked.

8. Unlock
This unlocks anything dragged into the PipeLine. If a directory is dragged into the PipeLine, then all its subfiles and subdirectories are unlocked recursively.
