ExecHacks
adds some handy menu buttons to CommandTool viewers: "DoIt" and "Redo".
"DoIt" deduces a filename from the selection, and depending on the extension executes some interesting command: for .Mesa files, it compiles; for .DF files it SModels and VerifiesDF; .cm or .load files are simply invoked; and so on. The action perfomed is actually determined by user profile entries, and can be extended by the user. The association given above is from the defaults, which are given below. The "DoIt" operation is purely textual, and the command is executed in the current working directory of the command tool, which may be different from the directory containing the file, so watch your directories.
When the DoIt operation is invoked on a file with extension foo, ExecHacks looks for a user profile entry ExecHacks.For.foo, or ExecHacks.ForNoExtension if the filename has no extension. The command to be executed is derived from the entry by replacing every occurrence of the string "<base>" by the base of the filename. File names are parsed in the form <directory><base>.<ext>!<version>. (Note that because of some people's small-mindedness, only the base field is available at this time for substitution.)
"Redo" performs two functions. Left or Middle buttoning "Redo" will replay the command currently pointed to. If the selection is at the end of the CommandTool viewer or in another viewer the most recently issued command is executed. Right buttoning "Redo" will list the last 10 commands issued to the CommandTool, with duplicates removed. These can then be left buttoned to reexecute.
To use it, add "ExecHacks" to the CommandTool.PerLogin and CommandTool.PerCommandTool entries in your profile. The ExecHacks command affects only the command tool it is invoked from.
ExecHacks also implements a UNIX-like redo. Issuing the command
% Redo fo
(in a command tool that has been hacked by ExecHacks) causes the most recent command whose name (excluding directory part) begins with fo. The command
% History -d 47
prints out the last 47 commands; if the number is omitted, 10 is used. The -d means to suppress duplicates. Also, a -% switch would suppress printing the prompt before each command. This is useful for building command files from history.
ExecHacks
has some user profile entries:
ExecHacks.DoitButtonName:
ROPE ← "DoIt"
The name to be used for the DoIt buttons posted in command tools.
ExecHacks.RedoButtonName:
ROPE ← "Redo"
The name to be used for the redo buttons.
ExecHacks.For.
Ext:
ROPE ←
SELECT Ext
FROM
(These are merely the defaults, turkey!)
Mesa, Cedar => "RCompile <base>"
Config => "Bind <base>"
cm, load => "<base>"
DF => "SModel <base>;\nVerifyDF <base>"
BCD => "Run <base>"
Profile => "Copy [User]<<base>>6.0> ← ///<base>.profile"
ENDCASE => "Blink"
This gives the command to be executed for files whose extension is Ext (disregarding case).
ExecHacks.ForNoExtension:
ROPE ← "RCompile <base>"
This gives the command to be executed for files that have no extension.