home *** CD-ROM | disk | FTP | other *** search
- SPAWN UTILITIES
- Copyright 1990, Albert H. Ariail
-
-
- DVTEST version 1.0
-
- Dvtest is a simple program that displays a message stating whether or not
- Desqview is active. If so, the current application name and number are
- listed. More importantly, dvtest exits setting the dos return code as
- follows:
-
- 0 desqview is not active
- nonzero desqview is active. return code set to current application number
-
- This way you may use an "if errorlevel" test to make batch files desqview
- specific or desqview aware. A particular example, of a sort that I
- actually use is as follows:
-
- dvtest >nul
- if not errorlevel 1 goto nodv
- spawn/d/f/x/p:ed c:\bin\edit.exe %1
- goto stop
- :nodv
- c:\bin\edit.exe %1
- :stop
-
- If desqview is active, the program is loaded in its own window as
- determined by the pif file ed-pif.dvp, otherwise, the program is just
- executed. With the current version of spawn, you could just invoke
- spawn, both inside and outside desqview. This method will save a bit
- of memory, however, when used outside of desqview.
-
-
- RELEASE.COM Version 1.0
-
- This program provides a way to pass a byte return code from batch file
- started by spawn. In order for spawn to process a return code, it
- must be waiting to receive one, ie, you must use spawn/w . Given this,
- then in the batch program started by spawn if you include the statement:
- release 3
- spawn will exit with a dos return code of 3.
- Processing continues as normal in the child process.
- If you do not include any argument, release assumes a value of 0.
- This program will only function with desqview active.
-
-
- KILL.COM Version 1.0
-
- This program allows you to close the current desqview window, or another
- window for which you have a "process handle".
-
- First, to close the window in which kill is executed, enter
-
- kill
-
- The action of kill is more like selecting "Close Window" from the
- desqview menu, or keying Ctrl-Alt-Del. The current window is just
- closed, without any clean up. This is generally safe, at least, in a
- batch file. The only side effect of this that I have found is that under
- certain circumstances, 4dos will dribble "swap" files around.
-
- To close another window, enter
-
- kill HANDLE
-
- where HANDLE is a window specifier described below. When used in this
- manner, no action is take to inform spawn that a window is being closed.
- If spawn is waiting for a return code, it will just sit there until you
- abort the wait by keying ESC.
-
- The window handle can be given as an 4 byte hexadecimal number in the
- format ?hhhhhhhh . This is not very useful, but is included for
- completeness. Otherwise you may use a symbolic name for the parameter
- such as:
-
- kill PARENT
-
- Kill will search the DOS environment for a handle listed under the
- specified name. If a valid desqview handle is found, the window it
- represents will be summarily dispatched. It just so happens that when
- spawn starts a process, it installs an entry of just this sort called
- "PARENT" in the child's environment, which can be used for this purpose.
-
- If the argument specified is not found in the environment, kill uses the
- argument as a file name and tries to find the correct handle by reading
- its contents. You may use spawn/n to create such a file, as in
-
- spawn/n ... >child
-
- then the command "kill child" will terminate the specified process.
-
- While all of this may satisfy some of your latent homicidal tendencies,
- it isn't of any great utility. A more satisfying application of kill
- is provided below, in conjunction with the program ALERT.
-
- Using fixed "temporary" files in this manner in a multitasking
- environment can cause a bit of unpleasantness. It is possible that
- some day you may start the same batch process twice. The second process
- will overwrite the same file "child", and when the first process hits
- the "kill" part, it will promptly shut down the wrong process. This may
- or may not be a major disaster, depending on who is doing what to whom.
-
- If you are using 4dos, there is a better way. 4dos has an internal
- function "INPUT" which copies text from standard input to an environment
- variable. Since the environment is local to each process, you will not
- have this sort of problem. For example,
-
- spawn /n mytask | input %%child
- ...
- kill child
-
- This is one example of about 1000 ways in which 4dos is better behaved
- that command.com . There are, I believe, public domain utilities that
- purport to do this sort of thing with a standard DOS system. I do not
- know if any of them work, especially with desqview, but if you can find
- one that does, using it for this would be recommended.
-
-
- ALERT.EXE Version 1.0
-
- Alert is general purpose "error message" / "status message" utility . It
- has be primarily designed as a means in which batch processes can display
- status or request operator intervention, even though they are running in
- a desqview window which is not currently visible. ALERT by no means
- requires desqview to function, however. You may wish to use it as well
- outside of desqview as a fancy version of the DOS command "pause".
-
- INSTALLATION (Read me, Please)
- Since desqview is not required to use Alert, you may wish to copy the
- executable file into a standard dos directory, such as \bin, rather than
- hiding it away in \dv . When you are using Alert with desqview, you
- configure 1K of "system memory" in any window which may use Alert. If
- you do not, you will have to respond to a non-fatal but irritating error
- message when Alert is invoked. If this is not convenient, the switch
- options (/a/t/s) do not require any system memory.
-
- Command Syntax:
-
- Alert [/x] "message"
-
- The quotation marks are not really required, but if you do not include
- them, Alert (actually Turbo-C) will strip white space for you.
- In Desqview, Alert will create a small window containing the message,
- punch it through to the foreground and wait for you to respond. You may
- acknowledge a message by pressing any key, or clicking the mouse. Please
- note that, in Desqview, the mouse cursor must be inside the message
- window in order for the mouse to work. Otherwise, you will be telling
- desqview to push the message window back into the background (something
- you may also want to do on occasion).
-
- Options:
-
- /h display help
- as you might expect, this displays a brief summary
- of the option available with this program
-
- /q quiet alarm
- beeps the speaker. Alert is silent by default.
-
- /l:tune loud alarm
- really beeps the speaker. The tune to play is a list of
- numbers in the format: freq,duration;freq,duration;...
- the duration is measured in "tics" (about 18 milliseconds).
- The maximum length is 32 freq,duration pairs. The default
- tune is: 450,4;500,4;550,4;500,4;450,4
-
- /m ignore mouse
- this should seldom be needed with desqview, but is included
- to prevent conflicts with menu software and the like.
-
- /w:n this displays the message text for n seconds or until
- any key is pressed . The message window will be in
- the foreground and will have possession of the keyboard
- /w:0 (the default) will wait forever
-
- /d:n display message for n seconds
- this also displays the message for n seconds, but does not
- look at the keyboard or the mouse (and does not own them).
- /d or /d:0 will cause alert to exit leaving the message
- window intact. In desqview, the message will be redisplayed
- every time you switch to the window which ran alert.
-
- /a alternate format
- this uses a different method for displaying the error window.
- It has primarily been included because in desqview no
- "system memory" is required. You cannot control the color,
- position, or the keyboard usage. To respond to a /a format
- message, key ESC or click the mouse. One additional use of
- this method is that since the error window is always displayed
- in the upper left corner of the window in question, /a will
- allow you to post a message that is closely associated with
- a given window. This is useful if there are a number of small
- desqview windows on the display.
-
- /t this is brain dead format.
- The text message is just printed using standard dos channels.
- This is supplied in case you have a need to use a 30k program
- to simulate the function of the DOS internal command "pause".
- Well, that's not completely true. Pause won't whistle dixie or
- respond to the mouse.
-
- /s use bios only.
- when this is specified outside of desqview, this cause the
- display routines to use the video bios rather that manipulating
- the display hardware directly. This may be needed on some machines.
- Inside desqview, this option causes alert to ignore the desqview
- window manager and function as though desqview were not present.
-
- /p:n uses physical attribute n (hex)
- controls the color of the message, the default is a boring
- white on black (see note on this below).
-
- /r:n position (row) of message window
- the default is 1
-
- /c:n position (col) of message window
- the default is selected to center the message text on the display.
- Outside of desqview, alert will support more than 80 columns.
- At this writing, desqview is a bit twitchy about doing that, so
- I don't recommend that you use more than 80 columns inside
- desqview.
-
- /k:ab keys to accept $=esc @=enter ?=any 1,2=mouse
- This represents a list of the keys that will be accepted to
- acknowledge the message. Case is not considered. Any key
- not on the list is ignored. You may use the special characters
- listed to represent some of the non-alphabetic keys. A space can
- be included, but you should enclose the entire parameter in
- quotes, eg, "/k: abc$"
-
- /f switch to the foreground
- This switches the entire process calling Alert into the
- foreground. Normally, only the message window will go to
- the foreground
-
- /b stay in the background
- The message will go to the top of the application calling Alert
- but not necessarily all the way to the foreground. If the Alert
- window is behind some other window, you will have to switch to
- the alert window to see the message.
-
- /n output window handle
- This only works with /d (or /d:0) since that is the only time
- a window remains behind after alert exits. The window handle
- is compatible with kill.com, which can be used to remove the
- message window, as in
- alert /n /d "hello world" >handle
- ...
- kill handle
-
- /z exit with background operation disabled
- alert normally requires the window in which it is executing to
- have background operation enabled. Alert will automatically set
- this, but will leave it enabled. If this causes a problem, you
- can use this option to tell alert to set the background flag to
- disabled just before it exits
-
- Notes:
-
- 1. Format switches
- The switches /d /w /t and /a are mutually exclusive. If you include
- more than one of these, only the last will have any effect. If no
- format switch is included, /w:0 is assumed
-
- 2. Behavior outside of Desqview.
- Most of the features of the program will work without desqview. There
- are some format differences and, since, I do not have available
- Desqview's powerful screen virtualization capabilities, /d:0 will not
- work the same. But the simulation is close enough so that you can
- put Alert calls into batch files without being overly concerned about
- what will happen if they are ever executed outside of desqview.
- The options /n /f /b /z have no meaning whatever without desqview and
- are ignored.
-
- 3. For best results with /d
- Using /d to display status messages will work better if the
- foreground window (that is, the window in which you are working, not
- the window which calls alert) has "runs in the background" set to
- "y". If this is done, the original program will not lose control
- of the keyboard. Otherwise, you will have to click the working
- window fully into the foreground to continue.
-
- In addition, if "writes directly to the screen" is set to "n", or
- "virtualize text" is on in the foreground window, the message window
- will not scroll off, but instead, the foreground text will scroll
- underneath the message window.
-
- 6 Color problems
- The default color for the message window is /p:07 (white on black).
- This value is used instead of something more interesting because
- of the way desqview handles color mapping in windows with "uses
- its own colors" set to "n". In this case alert will display the
- message window with the same colors as the parent window. When
- using /p:n, in this case, desqview will map the colors into something
- which is usually just awful. The only way to get true colors is to
- start alert with something like:
- spawn/w alert -p:31 "hello"
-
- 5. The keyboard filter and return codes.
- /d always exits with a return code of 0. If /k is not used
- alert will exit with a return code equal to the ascii code of
- the key that was pressed or '1'/'2' for the mouse. If /w:n times
- out without a keypress, alert sets the return code to 0. Non
- Ascii keys (such as Fkeys) set the return code to -x, where x
- is the byte value of the bios scan code for the key that was used.
- This is a little complex, but usable if you can figure out just
- what the heck "minus the bios scan code" is.
-
- /k is bit easier to use. /k will exit with a return code equal to
- the position of the key in the specified list. For example, if you
- use /k:abcd and respond with "C", alert will exit with a return
- code of 3 . You can then use "if errorlevel" tests to make the
- batch file do different things. Remember, "if errorlevel 3" means
- "if the return code is 3 or higher" so you will have to process you
- return codes from highest to lowest, eg.
-
- alert -w:10 /k:abcd? "hello world"
- if errorlevel 5 goto key_any
- if errorlevel 4 goto key_d
- if errorlevel 3 goto key_c
- if errorlevel 2 goto key_b
- if errorlevel 1 goto key_a
- goto nokey
-
- If you frequent PC magazine, you may recall a neat trick for
- making this sort of stuff a little more elegant
-
- for %%d in (5 4 3 2 1 0) do if errorlevel %d goto key_%d
- goto nokey
-
- :key_0
- ...
- :key_1
- ...
- :nokey
-
- If I have done my job right (I don't always) the last "goto nokey"
- will never be executed.
-
- Enjoy. AHA
-