Novell Home

Enhanced Windows Message Boxes from the Command Line

Novell Cool Solutions: Trench
By Bryan Keadle

Digg This - Slashdot This

Updated: 15 Jan 2005
 

With regard to the item, Not-so-Silent Install, I too needed a way to indicate that a NAL object was in the process of an install.

I created WinMsg.exe, a command line utility for providing Windows Message dialog boxes from the command line. Like the Reminder tool by James Davey, this utility will allow you to generate a message box to your users, but also allows you to specify window placement, font, colors, and buttons, and a variety of timeout options.

Download WinMsg.zip.

NAL Object Status Window for silent Installs

We have an Adobe Acrobat NAL object that uses the silent method for installing the application. However, to get it completely unattended, the silent mode is too silent, you're not sure whether the application is installing or not or when it's complete. So, in the distribution application object, I added this to the "before" Launch Script:

@echo off
echo.
echo Installing Adobe Acrobat 5...
echo.
if NOT EXIST "C:\Program Files\
Common Files\Adobe\Acrobat 5.0\NT\Uninst.isu" goto :END
echo.
echo Uninstalling previous version first...
echo Please wait...
C:\WINNT\ISUNINST.EXE -f"C:\Program Files\
Common Files\Adobe\Acrobat 5.0\NT\Uninst.isu" -c"C:\Program Files\
Common Files\Adobe\Acrobat 5.0\NT\Uninst.dll" -a -y
:END
start x:\winmsg.exe flag=file:%windir%\flags\adobedone.flg! 
"Please standby while Adobe Acrobat is installed" 
quiet colors=white,"0|128|0" textjustify=center 
Bold Title="NAL Application Distribution"

(Note: This before Launch Script checks for a pre-existing install, and does an unattended install first.)

Then, I added this to the "end" Launch Script:

@echo off
echo.
echo Adobe Acrobat 5 installation complete>%windir%\flags\adobedone.flg
pause

Now, as part of this distribution, I get a nice, colored message box, centered on the screen, waiting for the termination flag to exist (c:\winnt\flags\adobedone.flg).

When it does, the window closes and then deletes the flag file. The deleting of the flag file is done by the command-line parameter: flag=file:%windir%\flags\adobedone.flg! The exclamation point after the filename instructs WinMsg to delete the flag file.

WINMSG.exe /? gives this syntax screen. It's a pretty ugly syntax screen at this point because it has evolved to provide a lot of options and flexability. One has to slowly review all the options to appreciate its ability.

SYNTAX: WINMSG (INI / # of seconds) ("message" / Text file) (OPTIONS)

PARAMETERS:

INI - Read from same-named INI file for values such as TITLE, SECONDS, MESSAGE, etc.(See below)

# of SECONDS - Set to the number of seconds you want the message to be displayed. A value of 0 will keep message open until OK button confirmation

"message" - The message to be displayed, enlosed in quotes. Special characters {CR} for carriage return and {TAB} for tabs.

OPTIONS:

if only 1 parameter, and numeric: will read a TXT file of the same-root-name and location of the executable to be used as the message.

For example, copy WINMSG.EXE to Z:\PUBLIC\DAILY.EXE. Run DAILY.EXE, and DAILY.TXT will be created in Z:\PUBLIC and will be the message file used. Copy the same executable to X:\WEEKLY.EXE, and WEEKLY.TXT would be created in X:\WEEKLY.TXT and be the message file used for it.

Hold down the CTRL key to edit the file until the time-out period or while selecting the OK button, to modify the text in the message file.

ADDITIONAL OPTIONS:

TITLE="Window title"
TEXTJUSTIFY=Left/Right/Center (default: Left)
FONTTYPE=(fontname)
FONTSIZE=8,10,12,14
BOLD - (bold font)
COORD=(0,0,1000,1000) / WindowName (default: Center)
BUTTONS=YES|NO|CANCEL (default: OK)
you may specify a command to run in response to button pressed by delimiting command with a colon
For example: BUTTONS=Yes:MyCommand YesAction | No:MyCommand NoAction | Cancel
COLORS=Foreground,Background
BUTTONCOLORS=Foreground,Background
COUNTERCOLOR=
RUNSTATE=Icon/Hide/Zoom - if BUTTONS have command defined, RUNSTATE defines the state of the RUN window
SHIFTVAL= If the message box is too long for the text, enter a value to right-size the message box

FLAG=FlagType:FlagValue - (Terminate condition)
FILE:(filename) | WIN:(window name) | EXE:(exe name)
Wait for a given FILE, WINdow name, or EXEcutable to exist to terminate
Alternatively, preceed FlagValue with ! for "not". That is, wait for
Wait for a given FILE, WINdow name, or EXEcutable to NOT exist to terminate
Also, specify ! after the filename (FILE:filename!) to delete the flag file after terminating

COLORS include BLACK, WHITE, RED, GREEN, BLUE, YELLOW, GREY, NAVY, and LTGREY.

You may specify any other colors by entering their color code, #|#|#.

For example:

WINMSG 0 "Test Message" Title="This is a test" FontType=Tahoma FontSize=12 Colors=White,128|0|128 Bold

would create this message box:



and this:

winmsg 0 "I hope you enjoy this tool and find it useful!" colors=white,"0|128|0" textjustify=center Bold Title="Novell Cool Solutions" Buttons=Cool

would create this message box:

Download WinMsg.zip.


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell