[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [StrongED] quick way to kill task window
rickman@xxxxxxxxxxxxx wrote:
> Jeremy
> Thanks for the response. It is ingenious and it will help in some
> cases. The problem is, as you hinted at in your last paragraph, I
> might need to define more than one.
Ok, it's possible to get around that with a more complicated alias (eg using
redirection commands that append rather than overwrite a file, but then one
also needs to create the output file in the first instance), but there comes
a point where logic is required, so it's easier to define an alias that runs
an Obey file (or a BASIC program) and put the main logic in that. So...
(use copy & paste for the following)...
a) create a directory somewhere (where it will be filer_booted)
called !Trap
b) copy a !Sprites file into it from some other app so it will look
like an app with an application icon (you can edit the sprites
later if you care what they look like). This isn't just a
cosmetic stage, it's needed so that RO will think the pseudo
application actually has been filer_booted later on...
c) create three Obey files inside this new directory, called "!Boot"
and "!Run" and "Trap" (no exclamation mark on the last one).
d) in the !Boot Obey file put the following lines (and change the
definition of Trap$OutDir if you don't want the output files
to end up on ram disk). Define as many aliases as you want
making sure they have the right digit in their names and as
the first argument to the called Obey files:
Set Trap$Dir <Obey$Dir>
IconSprites <Trap$Dir>.!Sprites
| Specify where trapped command output will be placed:
Set Trap$OutDir RAM::0.$
IfThere <Trap$OutDir> Then Else Error <Trap$Dir>.!Boot needs an output dir.
Set alias$trap1 Obey <Trap$Dir>.Trap 1 %%*0
Set alias$trap2 Obey <Trap$Dir>.Trap 2 %%*0
Set alias$trap3 Obey <Trap$Dir>.Trap 3 %%*0
| If we were called from !Run then open the output directory:
If "%0" = "OPENDIR" Then Filer_OpenDir <Trap$OutDir>
e) In the !Run Obey file put the single line:
Obey <Obey$Dir>.!Boot OPENDIR
f) In the Trap Obey file put rather more lines:
| StrongED$WrapWidth=1024
| call with argument 1 - ie %0 - a digit, part of a filename
| with arguments 2-n - ie %*1 - the command to be executed
If "%0" = "" Then Error Trap's 1st parameter should be a digit
If "%1" = "" Then Error Trap's 2nd parameter should be a command
| decide if the output file already exists:
Set Trap$ofexists NO
IfThere <Trap$OutDir>.Trap%0 Then Set Trap$ofexists YES
| create the output file if needed
If "<Trap$ofexists>" = "NO" Then Create <Trap$OutDir>.Trap%0
| Place a series of lines in the output file:
|
| - if the file is new then a line setting the wrapwidth
| - a blank line to separate what comes next from the
| wrapwidth instruction or the prior contents of the file
| - a date and time header introducing the new output
| - a copy of the command whose output will follow
| - another blank line
If "<Trap$ofexists>" = "NO" Then Echo StrongED$WrapWidth=1024 { >>
<Trap$OutDir>.Trap%0 }
Echo { >> <Trap$OutDir>.Trap%0 }
Echo On <Sys$Date> <Sys$Year> at <Sys$Time> output from: { >>
<Trap$OutDir>.Trap%0 }
Echo command: %*1 { >> <Trap$OutDir>.Trap%0 }
Echo { >> <Trap$OutDir>.Trap%0 }
| run user-supplied command and redirect output to the file
%*1 { >> <Trap$OutDir>.Trap%0 }
| set the output file's filetype to text
SetType <Trap$OutDir>.Trap%0 Text
| filer_run the output file (so editor displays it)
Filer_Run <Trap$OutDir>.Trap%0
Note that two of the Echo lines are probably wrapped in your view of this;
they're long lines and need to be on a single line.
What does all this do?
1) I defined a 'pseudo' (or very very simple) application that can be
filer_booted and will define system variables and aliases when it
is filer_booted
2) the aliases: "trap1", "trap2", "trap3" etc all run the same obey
file, "trap" passing in a digit (1/2/3 etc) as a parameter and
a command. If there's no digit or no command that obey file will
generate an error message when it's run.
Otherwise the Trap obey file creates an output file if none already
exists. It then appends various lines: (StrongED$Wrapwidth=1024, a
blank line, date + time, something saying what the command about
to be executed actually is).
Then it issues the command and redirects the output.
Then it (re)sets the output file's type to Text and Filer_Runs it.
Successive calls of (say) *trap2 will append chunks of output to
the same file. But you've also got the trap1 and trap3 files, and
as many others as you define aliases for.
3) If you double-click the !Trap 'application' folder it will run the
!Run file that's in there. It merely calls the !Boot file with an
OPENDIR parameter. !Boot makes sure (as before) that necessary
system variables are set, then because OPENDIR was specified opens
a filer viewer on the directory where output files are placed.
--
Jeremy C B Nicoll - my opinions are my own.
--
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxxxxx