home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
w3_disk
/
cp-72d.arj
/
NEWSTUFF.MA$
< prev
next >
Wrap
Text File
|
1992-02-26
|
127KB
|
5,403 lines
Update Manual
for
Command Post
and
WinBatch
This document is an addendum to the manuals for
Command Post and WinBatch, and covers new
functions and features added since the manuals
for those programs went to press.
Items marked with an asterisk (*) are new in
Command Post, but are already covered in the
WinBatch documentation.
Items marked (CP only) are available only in
Command Post.
Items marked (WB only) are available only in
WinBatch.
"WIL Interpreter" is a generic term which
refers both to Command Post and to WinBatch.
"WIL program" is a generic term which refers
both to a Command Post menu item and to a
WinBatch WBT file.
(i) indicates an integer parameter or return
value.
(s) indicates a string parameter or return
value.
Please refer to the approprate program manual
for information on anything not covered here.
ii
WIL Update Manual
CONTENTS
CONTENTS ii
NEW FUNCTIONS 1
AskPassword 1
DDEExecute 1
DDEInitiate 2
DDEPoke 3
DDERequest 4
DDETerminate 5
DDETimeout 6
DialogBox* 6
DirRename* 8
DirWindows 8
DiskHide (CP only) 9
DiskReset (CP only) 9
DiskScan 10
DiskUpdate (CP only) 11
DOSVersion* 11
Exclusive* 12
FileAppend* 13
FileAttrGet 13
FileAttrSet 14
FileClose* 15
FileExtension* 16
FileHilite (CP only) 16
FileOpen* 17
FilePath* 18
FileRead* 18
FileRoot* 19
FileTimeGet 19
FileTimeTouch 20
FileWrite* 21
Goto* 22
IconArrange 22
If...Then* 23
IgnoreInput* 23
iii
WIL Update Manual
IniDelete 24
IniDeletePvt 24
IniItemize 25
IniItemizePvt 26
IniReadPvt* 26
IniWritePvt* 27
IntControl 28
IsKeyDown* 31
IsLicensed* 32
ItemCount* 32
ItemExtract* 33
MouseInfo 34
NetAddCon 35
NetBrowse 36
NetCancelCon 37
NetDialog 37
NetGetCaps 38
NetGetCon 39
NetGetUser 40
ParseData* 40
PlayMedia 41
PlayMidi 43
PlayWaveForm 43
SendKey* 44
SKDebug* 46
SnapShot 47
Sounds 48
StrReplace* 48
TextSelect 49
WaitForKey 50
WallPaper* 51
WinConfig* 51
WinExeName 52
WinExist* 53
WinMetrics 53
WinName 56
WinParmGet 56
WinParmSet 57
WinPlaceGet 58
WinPlaceSet 59
WinPosition* 60
WinResources 61
WinState 61
iv
WIL Update Manual
OTHER FEATURES 63
Changes to both Command Post and
WinBatch 63
:CANCEL 63
Default program for unknown
extension 63
Better pro launch diagnostics 64
New INI file 64
Improved Display function 64
Longer Delay 64
Change in DialogBox 64
Partial windowname option 65
Improved StrTrim 65
Noise 65
FileOpen error message 65
Changes to Command Post only 65
Hotkeys 65
Multiple menu levels 66
Window placement on startup 66
Terminate Windows option 67
File attribute display 67
Hidden and System files 67
Parent directory (dot dot) 67
Program run options 67
Non-displayed menu items 67
DIALOG BOXES 68
v
WIL Update Manual
NEW FUNCTIONS
AskPassword
Prompts the user for a password.
Syntax:
AskPassword (title, prompt)
Parameters:
(s) title title of the dialog box.
(s) prompt question to be put to the user.
Returns:
(s) user response.
Pops up a special dialog box to ask for
passwords. An asterisk (*) is echoed for each
character that the user types; the actual
characters entered are not displayed.
Example:
pw = AskPassword("Security check", "Please
enter your password")
If StriCmp(pw, "winguy") != 0 Then Goto nogo
Run(Environment("COMSPEC"), "")
Exit
:nogo
Pause("Security breach", "Invalid password
entered")
See Also:
AskLine, AskYesNo, DialogBox
1
WIL Update Manual
DDEExecute
Sends commands to a DDE server application.
Syntax:
DDEExecute (channel, command string)
Parameters:
(i) channel same integer that was
returned by DDEInitiate.
(s) command string one or more commands to be
executed by the server app.
Returns:
(i) @TRUE if successful; @FALSE if
unsuccessful.
Use the DDEInitiate function to obtain a
channel number.
In order to use this function successfully, you
will need appropriate documentation for the
server application you wish to access, which
must provide information on the DDE functions
that it supports and the correct syntax to use.
Example:
Run("wincheck.exe", "TUT")
channel = DDEInitiate("wincheck", "TUT")
If channel == 0 Then Goto failed
result = DDEExecute(channel,
'[WriteCheck:p="Shorewood
Apartments",t=580.00,l="Rent"]')
DDETerminate(channel)
WinClose("WinCheck")
If result == @FALSE Then Goto Failed
Message("DDE Execute", "Operation complete")
Exit
:failed
Message("DDE operation unsuccessful", "Check
your syntax")
2
WIL Update Manual
See Also:
DDEInitiate, DDEPoke, DDERequest,
DDETerminate, DDETimeout
DDEInitiate
Opens a DDE channel.
Syntax:
DDEInitiate (app name, topic name)
Parameters:
(s) app name name of the application (without
the EXE extension).
(s) topic name name of the topic you wish
to access.
Returns:
(i) communications channel.
This function opens a DDE communications
channel with a server application. The
communications channel can be subsequently used
by the DDEExecute, DDEPoke, and DDERequest
functions. You should close this channel with
DDETerminate when you are finished using it.
If the communications channel cannot be opened
as requested, DDEInitiate returns a channel
number of 0.
You can call DDEInitiate more than once, in
order to carry on multiple DDE conversations
(with multiple applications) simultaneously.
In order to use this function successfully, you
will need appropriate documentation for the
server application you wish to access, which
must provide information on the DDE functions
that it supports and the correct syntax to use.
3
WIL Update Manual
Example:
Run("wincheck.exe", "TUT")
channel = DDEInitiate("WinCheck", "TUT")
If channel == 0 Then Goto failed
output = DDERequest(channel, "GetChecking")
DDETerminate(channel)
WinClose("WinCheck")
If output == "" Then Goto Failed
Message("Account balance", output)
Exit
:failed
Message("DDE operation unsuccessful", "Check
your syntax")
See Also:
DDEExecute, DDEPoke, DDERequest,
DDETerminate, DDETimeout
DDEPoke
Sends data to a DDE server application.
Syntax:
DDEPoke (channel, item name, item value)
Parameters:
(i) channel same integer that was returned
by DDEInitiate.
(s) item name identifies the type of data
being sent.
(s) item value actual data to be sent to
the server.
Returns:
(i) @TRUE if successful; @FALSE if
unsuccessful.
Use the DDEInitiate function to obtain a
channel number.
4
WIL Update Manual
In order to use this function successfully, you
will need appropriate documentation for the
server application you wish to access, which
must provide information on the DDE functions
that it supports and the correct syntax to use.
Example:
Run("reminder.exe", "")
channel = DDEInitiate("Reminder", "items")
If channel == 0 Then Goto failed
result = DDEPoke(channel, "all", "11/3/92 Misc
Remember to vote")
DDETerminate(channel)
WinClose("Reminder")
If result == @FALSE Then Goto Failed
Message("DDE Poke", "Operation complete")
Exit
:failed
Message("DDE operation unsuccessful", "Check
your syntax")
See Also:
DDEExecute, DDEInitiate, DDERequest,
DDETerminate, DDETimeout
DDERequest
Gets data from a DDE server application.
Syntax:
DDERequest (channel, item name)
Parameters:
(i) channel same integer that was returned
by DDEInitiate.
(s) item name identifies the data to be
returned by the server.
5
WIL Update Manual
Returns:
(s) information returned from the
server.
Use the DDEInitiate function to obtain a
channel number.
In order to use this function successfully, you
will need appropriate documentation for the
server application you wish to access, which
must provide information on the DDE functions
that it supports and the correct syntax to use.
Example:
Run("wincheck.exe", "TUT")
channel = DDEInitiate("WinCheck", "TUT")
If channel == 0 Then Goto failed
output = DDERequest(channel, "GetChecking")
DDETerminate(channel)
WinClose("WinCheck")
If output == "" Then Goto Failed
Message("Account balance", output)
Exit
:failed
Message("DDE operation unsuccessful", "Check
your syntax")
See Also:
DDEExecute, DDEInitiate, DDEPoke,
DDETerminate, DDETimeout
DDETerminate
Closes a DDE channel.
Syntax:
DDETerminate (channel)
6
WIL Update Manual
Parameters:
(i) channel same integer that was returned
by DDEInitiate.
Returns:
(i) always 1.
This function closes a communications channel
that was opened with DDEInitiate.
Example:
Run("wincheck.exe", "TUT")
channel = DDEInitiate("WinCheck", "TUT")
If channel == 0 Then Goto failed
output = DDERequest(channel, "GetChecking")
DDETerminate(channel)
WinClose("WinCheck")
If output == "" Then Goto Failed
Message("Account balance", output)
Exit
:failed
Message("DDE operation unsuccessful", "Check
your syntax")
See Also:
DDEExecute, DDEInitiate, DDEPoke, DDERequest,
DDETimeout
DDETimeout
Sets the DDE timeout value.
Syntax:
DDETimeout (value)
Parameters:
(i) value DDE timeout time.
Returns:
(i) previous timeout value.
7
WIL Update Manual
Sets the timeout time for subsequent DDE
functions to specified value in milliseconds
(1/1000 second). Default is 3000 milliseconds
(3 seconds). If the time elapses with no
response, the WIL Interpreter will return an
error. The value set with DDETimeout stays in
effect until changed by another DDETimeout
statement or until the WIL program ends,
whichever comes first.
Example:
DDETimeout(5000)
Run("wincheck.exe", "TUT")
channel = DDEInitiate("WinCheck", "TUT")
If channel == 0 Then Goto failed
output = DDERequest(channel, "GetChecking")
DDETerminate(channel)
WinClose("WinCheck")
If output == "" Then Goto Failed
Message("Account balance", output)
Exit
:failed
Message("DDE operation unsuccessful", "Check
your syntax")
See Also:
DDEExecute, DDEInitiate, DDEPoke, DDERequest,
DDETerminate
DialogBox*
Pops up a Windows dialog box defined by the WBD
template file.
Syntax:
DialogBox (title, WBD file)
8
WIL Update Manual
Parameters:
(s) title the title of the dialog box.
(s) WBD file the name of the WBD template
file.
Returns:
(i) always 0.
Each element in the template file is enclosed
in square brackets, and consists of a variable
name, followed by one of the following symbols:
Symbol Meaning Example
+ check box [backup+1Save
backup]
# edit box [newfile# ]
\ file selection listbox
[editfile\ ]
^ radio button [prog^1Note]
[prog^2Write]
$ variable [var$]
The number following the check box and radio
button symbols is the value which will get
assigned to the variable if its corresponding
box is checked, or button is selected.
Following the number is the descriptive text
which will appear next to the box or button.
When used in conjunction with a file selection
list box variable with the same name, two of
these symbols have special meanings:
# file mask edit box
[editfile# ]
$ directory variable
[editfile$ ]
Anything not appearing within square brackets
is displayed as text.
9
WIL Update Manual
See the separate section on Dialog Boxes later
in this manual for more detailed information on
using this function.
Example:
DialogBox("Edit a file", "edit.wbd")
If backup == 0 Then Goto nobackup
filebackupname = StrCat(FileRoot(editfile),
".", "bak")
FileCopy(editfile, filebackupname, @TRUE)
:nobackup
If prog == 1 Then Run("notepad.exe", editfile)
If prog == 2 Then
Run("c:\win\apps\winedit.exe", editfile)
Here is the template file, EDIT.WBD:
[editfile$ ]
File mask [editfile# ]
[editfile\ ]
[editfile\ ]
[editfile\ ]
[editfile\ ]
[editfile\ ]
[backup+1Save backup of file]
[prog^1Notepad] [prog^2WinEdit]
See Also:
AskLine, AskPassword, AskYesNo, ItemSelect
DirRename*
Renames a directory.
Syntax:
DirRename ([d:]oldpath, [d:]newpath)
10
WIL Update Manual
Parameters:
(s) oldpath existing directory name, with
optional drive.
(s) newpath new name for directory.
Returns:
(i) @TRUE if the directory was
successfully renamed;
@FALSE if it wasn't.
Example:
DirRename("c:\temp", "c:\work")
See Also:
DirMake, DirRemove
DirWindows
Returns the name of the Windows or Windows
System directory.
Syntax:
DirWindows (request#)
Parameters:
(i) request# see below.
Returns:
(s) directory name.
This function returns the name of either the
Windows directory or the Windows System
directory, depending on the request# specified.
Req# Return value
0 Windows directory
1 Windows System directory
11
WIL Update Manual
Example:
DirChange(DirWindows(0))
ini = ItemSelect("Select file to edit",
FileItemize("*.ini"), " ")
Run("notepad.exe, ini)
See Also:
DirHome
DiskHide (CP only)
Hides disk drives from display.
Syntax:
DiskHide (drive-list)
Parameters:
(s) drive-list string of drives to hide
(non-delimited).
Returns:
(i) always 1.
This function causes the drive letters
specified in "drive-list" to be removed from
the disk drive icon display.
Example:
DiskHide("STUVW")
See Also:
DiskReset, DiskUpdate
DiskReset (CP only)
Re-examines available disk drives.
12
WIL Update Manual
Syntax:
DiskReset ( )
Parameters:
(none)
Returns:
(i) always 0.
Examines disk drives on system, and adds any
new drives found to the display of drive icons.
If an existing drive was hidden with the
DiskHide function, it will no longer be hidden
(unlike the DiskUpdate function).
Example:
DiskReset()
See Also:
DiskHide, DiskUpdate
DiskScan
Returns list of drives.
Syntax:
DiskScan (request#)
Parameters:
(i) request# see below.
Returns:
(s) drive list.
Scans disk drives on the system, and returns a
space-delimited list of drives of the type
specified by request#, in the form "A: B: C: D:
".
13
WIL Update Manual
The request# is a bitmask, so adding the values
together (except for 0) returns all drive types
specified; eg., a request# of 3 returns floppy
plus local hard drives.
Req# Return value
0 List of unused disk IDs
1 List of floppy drives
2 List of local hard drives
4 List of remote (network) drives
Example:
hd = DiskScan(2)
Message("Hard drives on system", hd)
See Also:
DiskFree, LogDisk
DiskUpdate (CP only)
Updates drive icon display.
Syntax:
DiskUpdate ( )
Parameters:
(none)
Returns:
(i) always 0.
Examines disk drives on system, and adds any
new drives found to the display of drive icons.
If an existing drive was hidden with the
DiskHide function, it will remain hidden
(unlike the DiskReset function).
14
WIL Update Manual
Example:
DiskUpdate()
See Also:
DiskHide, DiskReset
DOSVersion*
Returns the version numbers of the current
version of DOS.
Syntax:
DOSVersion (level)
Parameters:
(i) level @MAJOR or @MINOR.
Returns:
(i) integer or decimal part of DOS
version number.
@MAJOR returns the integer part (to the left of
the decimal).
@MINOR returns the decimal part (to the right
of the decimal).
If the version of DOS in use is 4.0, then:
DOSVersion(@MAJOR) == 4
DOSVersion(@MINOR) == 0
Example:
i = DOSVersion(@MAJOR)
d = DOSVersion(@MINOR)
If StrLen(d) == 1 Then d = StrCat("0", d)
Message("DOS Version", "%i%.%d%")
15
WIL Update Manual
See Also:
Environment, Version, WinVersion
Exclusive*
Controls whether or not other Windows programs
will get any time to execute.
Syntax:
Exclusive (mode)
Parameters:
(i) mode @ON or @OFF.
Returns:
(i) previous Exclusive mode.
Exclusive(@OFF) is the default mode. In this
mode,the WIL Interpreter is well-behaved toward
other Windows applications.
Exclusive(@ON) allows WIL programs to run
somewhat faster, but causes the WIL Interpreter
to be "greedier" about sharing processing time
with other active Windows applications. For
the most part, this mode is useful only when
you have a series of WIL statements which must
be executed in quick succession.
16
WIL Update Manual
Example:
Exclusive(@ON)
x = 0
start = DateTime()
:add
x = x + 1
If x < 1000 Then Goto add
stop = DateTime()
crlf = StrCat(Num2Char(13), Num2Char(10))
Message("Times", "Start: %start%%crlf%Stop:
%stop%")
Exclusive(@OFF)
See Also:
Yield
FileAppend*
Appends one or more files to another file.
Syntax:
FileAppend (source-list, destination)
Parameters:
(s) source-list a string containing one or
more filenames, which may be
wildcarded.
(s) destination target file name.
Returns:
(i) @TRUE if all files were appended
successfully;
@FALSE if at least one file wasn't
appended.
Use this function to append an individual file
or a group of files to the end of an existing
file. If "destination" does not exist, it will
be created.
17
WIL Update Manual
The file(s) specified in "source-list" will not
be modified by this function.
"Source-list" may contain * and ? wildcards.
"Destination" may not contain wildcards of any
type; it must be a single file name.
Examples:
FileAppend("c:\config.sys",
"c:\misc\config.sav")
DirChange("c:\batch")
FileDelete("allbats.fil")
FileAppend("*.bat", "allbats.fil")
See Also:
FileCopy, FileDelete, FileExist
FileAttrGet
Returns file attributes.
Syntax:
FileAttrGet (filename)
Parameters:
(s) filename file whose attributes you want
to determine.
Returns:
(s) attribute settings.
Returns attributes for the specified file, in a
string of the form "RASH". This string is
composed of four individual attribute
characters, as follows:
Char Symbol Meaning
18
WIL Update Manual
1 R Read-only ON
2 A Archive ON
3 S System ON
4 H Hidden ON
A hyphen in any of these positions indicates
that the specified attribute is OFF. For
example, the string "-A-H" indicates a file
which has the Archive and Hidden attributes
set.
Example:
editfile = "c:\config.sys"
attr = FileAttrGet(editfile)
If StrSub(attr, 1, 1) == "R" Then Goto
readonly
Run("notepad.exe", editfile)
Exit
:readonly
Message("File is read-only", "Cannot edit
%editfile%")
See Also:
FileAttrSet, FileTimeGet
FileAttrSet
Sets file attributes.
Syntax:
FileAttrSet (file-list, settings)
Parameters:
(s) file-list space-delimited list of files.
(s) settings new attribute settings for those
file(s).
Returns:
(i) always 0.
19
WIL Update Manual
The attribute string consists of one or more of
the following characters (an upper case letter
turns the specified attribute ON, a lower case
letter turns it OFF):
R read only ON
A archive ON
S system ON
H hidden ON
r read only OFF
a archive OFF
s system OFF
h hidden OFF
Examples:
FileAttrSet("win.ini system.ini", "rAsH")
FileAttrSet("c:\command.com", "R")
See Also:
FileAttrGet, FileTimeTouch
FileClose*
Closes a file.
Syntax:
FileClose (filehandle)
Parameters:
(i) filehandle same integer that was
returned by FileOpen.
Returns:
(i) always 0.
20
WIL Update Manual
Example:
; the hard way to copy an ASCII file
old = FileOpen("config.sys", "READ")
new = FileOpen("sample.txt", "WRITE")
:top
x = FileRead(old)
If x != "*EOF*" Then FileWrite(new, x)
If x != "*EOF*" Then Goto top
FileClose(new)
FileClose(old)
See Also:
FileOpen, FileRead, FileWrite
FileExtension*
Returns extension of file.
Syntax:
FileExtension (filename)
Parameters:
(s) filename [optional path] complete file
name, with extension.
Returns:
(s) file extension.
FileExtension parses the passed filename and
returns the extension part of the filename.
21
WIL Update Manual
Example:
; prevent the user from editing a COM or EXE
file
allfiles = FileItemize("*.*")
editfile = ItemSelect("Select file to edit",
allfiles, " ")
ext = FileExtension(editfile)
If (ext == "com") || (ext == "exe") Then Goto
noedit
run("notepad.exe", editfile)
exit
:noedit
Message ("Sorry", "You may not edit a program
file")
See Also:
FilePath, FileRoot
FileHilite (CP only)
Hilites or unhilites files in file display.
Syntax:
FileHilite (file-masks, mode)
Parameters:
(s) file-masks one or more file
specifications, which may be
wildcarded.
(i) mode @TRUE Hilight matching files.
@FALSE Unhilight matching files.
Returns:
(i) total number of files highlighted or
unhilighted.
This function causes one or more groups of
files in the file display window to be
highlighted (selected) or unhighlighted (de-
selected). This is useful to select files for
22
WIL Update Manual
an operation such as FileCopy, or just to
spotlight certain files in a directory.
Multiple file specifications must be space-
delimited.
Examples:
FileHilite("*.ZIP *.LZH *.ARC", @TRUE)
FileHilite("OLD*.ZIP", @FALSE)
See Also:
CurrentFile, FileExtension
FileOpen*
Opens a STANDARD ASCII (only) file for reading
or writing.
Syntax:
FileOpen (filename, open-type)
Parameters:
(s) filename name of the file to open.
(s) open-type "READ" or "WRITE".
Returns:
(i) filehandle
The "filehandle" returned by the FileOpen
function is subsequently used by the FileRead,
FileWrite, and FileClose functions.
Examples:
; To open for reading:
FileOpen("stuff.txt", "READ")
23
WIL Update Manual
; To open for writing:
FileOpen("stuff.txt", "WRITE")
See Also:
FileClose, FileRead, FileWrite
FilePath*
Returns path of file.
Syntax:
FilePath (filename)
Parameters:
(s) filename fully qualified file name,
including path.
Returns:
(s) fully qualified path name.
FilePath parses the passed filename and returns
the drive and path of the file specification,
if any.
Example:
coms = Environment("COMSPEC")
compath = FilePath(coms)
Message("", "Your command processor is located
in the %compath% directory")
See Also:
FileExtension, FileRoot
FileRead*
Reads data from a file.
24
WIL Update Manual
Syntax:
FileRead (filehandle)
Parameters:
(i) filehandle same integer that was
returned by FileOpen.
Returns:
(s) line of data read from file.
When the end of the file is reached, the string
*EOF* will be returned.
Example:
handle = FileOpen("autoexec.bat", "READ")
:top
line = FileRead(handle)
Display(4, "AUTOEXEC DATA", line)
If line != "*EOF*" Then Goto top
FileClose(handle)
See Also:
FileClose, FileOpen, FileWrite
FileRoot*
Returns root of file.
Syntax:
FileRoot (filename)
Parameters:
(s) filename [optional path]complete file
name, with extension.
Returns:
(s) file root.
25
WIL Update Manual
FileRoot parses the passed filename and returns
the root part of the filename.
Example:
allfiles = FileItemize("*.*")
editfile = ItemSelect("Select file to edit",
allfiles, " ")
root = FileRoot(editfile)
ext = FileExtension(editfile)
lowerext = StrLower(ext)
nicefile = StrCat(root, ".", lowerext)
Message("", "You are about to edit
%nicefile%.")
Run("notepad.exe", editfile)
See Also:
FileExtension, FilePath
FileTimeGet
Returns file date and time.
Syntax:
FileTimeGet (filename)
Parameters:
(s) filename name of file for which you want
the date and time.
Returns:
(s) file date and time.
This function will return the date and time of
a file, in a pre-formatted string. The format
it is returned in depends on the date format
specified in the [International] section of the
WIN.INI file:
26
WIL Update Manual
ddd mm:dd:yy hh:mm:ss XX
ddd dd:mm:yy hh:mm:ss XX
ddd yy:mm:dd hh:mm:ss XX
Where:
ddd is day of the week (e.g. Mon)
mm is the month (e.g. 10)
dd is the day of the month (e.g. 23)
yy is the year (e.g. 90)
hh is the hours
mm is the minutes
ss is the seconds
XX is the Day/Night code (e.g. AM or PM)
The WIN.INI file will be examined to determine
which format to use. You can adjust the
WIN.INI file via the International section of
Control Panel if the format isn't what you
prefer.
Example:
oldtime = FileTimeGet("win.ini")
Run("notepad.exe", "win.ini")
WinWaitClose("Notepad - WIN.INI")
newtime = FileTimeGet("win.ini")
If StrCmp(oldtime, newtime) == 0 Then Exit
Message("", "WIN.INI has been changed")
See Also:
FileAttrGet, FileTimeTouch
FileTimeTouch
Sets file(s) to current time.
Syntax:
FileTimeTouch (file-list)
27
WIL Update Manual
Parameters:
(s) file-list a space-delimited list of files
Returns:
(i) always 0
"File-list" is a space-delimited list of files,
which may not contain wildcards. The path is
searched if the file is not found in current
directory and if the directory is not specified
in "file-list".
Example:
FileTimeTouch("wac.c wac.rc")
Run("make.exe", "-fwac.mak")
See Also:
FileAttrSet, FileTimeGet
FileWrite*
Writes data to a file.
Syntax:
FileWrite(filehandle, output-data)
Parameters:
(i) filehandle same integer that was
returned by FileOpen.
(s) output-data data to write to file.
Returns:
(i) always 0.
28
WIL Update Manual
Example:
handle = FileOpen("stuff.txt", "WRITE")
FileWrite(handle, "Gobbledygook")
FileClose(handle)
See Also:
FileClose, FileOpen, FileRead
Goto*
Changes the flow of control in a WIL program.
Syntax:
Goto label
Parameters:
(s) label user-defined identifier.
Goto label causes an unconditional branch to
the line in the program marked :label, where
the identifier is preceded by a colon (:).
Example:
If WinExist("Solitaire") == @FALSE Then Goto
open
WinActivate("Solitaire")
Goto loaded
:open
Run("sol.exe", "")
:loaded
See Also:
If ... Then
29
WIL Update Manual
IconArrange
Rearranges icons.
Syntax:
IconArrange ( )
Parameters:
(none)
Returns:
(i) always 0.
This function rearranges the icons at the
bottom of the screen, spacing them evenly. It
does not change the order in which the icons
appear.
Example:
IconArrange ( )
See Also:
RunIcon, WinIconize, WinPlaceSet
If...Then*
Conditionally performs a function.
Syntax:
If condition Then statement
Parameters:
(s) condition an expression to be evaluated.
(s) statement any valid WIL function or
command.
If the condition following the If keyword is
true, the statement following the Then keyword
is executed. If the condition following the If
30
WIL Update Manual
keyword is false, the statement following the
Then keyword is ignored.
Example:
sure = AskYesNo("End Session", "Really quit
Windows?")
If sure == @YES Then EndSession()
See Also:
Goto
IgnoreInput*
Turns off hardware input to windows.
Syntax:
IgnoreInput(mode)
Parameters:
(i) mode @TRUE or @FALSE.
Returns:
(i) previous IgnoreInput mode.
IgnoreInput causes mouse movements, clicks and
keyboard entry to be completely ignored. Good
for self-running demos.
Warning: If you are not careful with the use of
IgnoreInput, you can lock up your computer!
Example:
username = AskLine("Hello", "Please enter your
name","")
IgnoreInput(@TRUE)
Call("demo.wbt", username)
IgnoreInput(@FALSE)
31
WIL Update Manual
IniDelete
Removes a line or section from WIN.INI.
Syntax:
IniDelete (section, keyname)
Parameters:
(s) section the major heading under which
the item is located.
(s) keyname the name of the item to delete.
Returns:
(i) always 0
This function will remove the specified line
from the specified section in WIN.INI. You can
remove an entire section, instead of just a
single line, by specifying a keyword of
@WHOLESECTION. Case is not significant in
section or keyname.
Examples:
IniDelete("Desktop", "Wallpaper")
IniDelete("Quicken",@WHOLESECTION)
See Also:
IniDeletePvt, IniItemize, IniRead, IniWrite
IniDeletePvt
Removes a line or section from a private INI
file.
Syntax:
IniDeletePvt (section, keyname, filename)
32
WIL Update Manual
Parameters:
(s) section the major heading under which
the item is located.
(s) keyname the name of the item to delete.
(s) filename name of the INI file.
Returns:
(i) always 0.
This function will remove the specified line
from the specified section in a private INI
file. You can remove an entire section,
instead of just a single line, by specifying a
keyword of @WHOLESECTION. Case is not
significant in section or keyname.
Example:
IniDeletePvt("Current Users", "Excel",
"meter.ini")
See Also:
IniDelete, IniItemizePvt, IniReadPvt,
IniWritePvt
IniItemize
Lists keywords or sections in WIN.INI.
Syntax:
IniItemize (section)
Parameters:
(s) section the major heading to itemize.
Returns:
(s) list of keywords or sections.
IniItemize will scan the specified section in
WIN.INI, and return a space-delimited list of
33
WIL Update Manual
all keyword names contained within that
section. If a null string ("") is given as the
section name, IniItemize will return a list of
all section names contained within WIN.INI.
Case is not significant in section names.
Examples:
; Returns all keywords in the [Extensions]
section
keywords = IniItemize("Extensions")
; Returns all sections in the entire WIN.INI
file
sections = IniItemize("")
See Also:
IniDelete, IniItemizePvt, IniRead, IniWrite
IniItemizePvt
Lists keywords or sections in a private INI
file.
Syntax:
IniItemizePvt (section, filename)
Parameters:
(s) section the major heading to itemize.
(s) filename name of the INI file.
Returns:
(s) list of keywords or sections.
IniItemizePvt will scan the specified section
in a private INI file, and return a space-
delimited list of all keyword names contained
within that section. If a null string ("") is
given as the section name, IniItemizePvt will
return a list of all section names contained
34
WIL Update Manual
within the file. Case is not significant in
section names.
Example:
; Returns all keywords in the [Boot] section
of SYSTEM.INI
keywords = IniItemizePvt("Boot", "system.ini")
See Also:
IniDeletePvt, IniItemize, IniReadPvt,
IniWritePvt
IniReadPvt*
Reads data from a private INI file.
Syntax:
IniReadPvt (section, keyname, default,
filename)
Parameters:
(s) section the major heading to read the
data from.
(s) keyname the name of the item to read.
(s) default string to return if the desired
item is not found.
(s) filename name of the INI file.
Returns:
(s) data from the INI file.
Looks up a value in the "filename".INI file.
If the value is not found, the "default" will
be returned.
Example:
IniReadPvt("Main", "Lang", "English",
"WB.INI")
35
WIL Update Manual
Given the following segment from WB.INI:
[Main]
Lang=French
The statement above would return:
French
See Also:
IniDeletePvt, IniItemizePvt, IniRead,
IniWritePvt
IniWritePvt*
Writes data to a private INI file.
Syntax:
IniWritePvt (section, keyname, data, filename)
Parameters:
(s) section major heading to write the data
to.
(s) keyname name of the data item to write.
(s) data string to write to the INI file.
(s) filename name of the INI file.
Returns:
(i) always 1.
Writes a value in the "filename".INI file.
Example:
IniWritePvt("Main", "Lang", "French, "WB.INI")
This would create the following entry in
WB.INI:
36
WIL Update Manual
[Main]
Lang=French
See Also:
IniDeletePvt, IniItemizePvt, IniReadPvt,
IniWrite
IntControl
Internal control functions.
Syntax:
IntControl (request#, p1, p2, p3, p4)
Parameters:
(i) request# specifies which sub-function is
to be performed (see below).
(s) p1 - p4 parameters which may be required
by the function (see below).
Returns:
(s) varies (see below).
Short for Internal Control, a special function
that permits numerous internal operations in
the CP and WB products. The first parameter of
IntControl defines exactly what the function
does, the other parameters are possible
arguments to the function.
Warning: Many of these operations are useful
only under special circumstances, and/or by
technically knowledgeable users. Some could
lead to adverse side effects. If it isn't
clear to you what a particular function does,
don't use it.
37
WIL Update Manual
IntControl (1, p1, 0, 0, 0)
Just a test IntControl. It echoes back P1 & P2
and P3 & P4 in a pair of message boxes.
IntControl (2, 0, 0, 0, 0) (CP only)
Returns the number of Command Post windows
currently open.
IntControl (3, 0, 0, 0, 0) (CP only)
Writes the positions of each open Command Post
window to the WWW-PROD.INI file, using the
WinPositionXY format.
IntControl (4, p1, 0, 0, 0)
Controls whether or not a dialog box with a
file listbox in it has to return a file name,
or may return merely a directory name or
nothing.
P1 Meaning
0 May return nothing, or just a directory
name
1 Must return a file name (default)
IntControl (5, p1, 0, 0, 0)
Controls whether system & hidden files are seen
and processed.
P1 Meaning
0 System & Hidden files not used (default)
1 System & Hidden files seen and used
IntControl (6, 0, 0, 0, 0) (CP only)
Positions all open Command Post windows, based
on the information in the WWW-PROD.INI file.
38
WIL Update Manual
IntControl (8, 0, 0, 0, 0) (CP only)
Reloads Command Post menus, just like selecting
"Reload Menu" from the system menu.
IntControl (9, p1, 0, 0, 0) (CP only)
Controls Command Post window resizing.
P1 Meaning
0 Resize automagically on open and close
(default)
1 disable resize on window close
2 disable resize on window open
3 disable resize on open and close
IntControl (10, p1, 0, 0, 0)
Interrogates the Command Extender DLL status
P1 Meaning
0 Command Extender present
0 No
1 Yes
1 Command Extender version
-1 No Extender present
0 Incompatible extender present
(other) Extender version code
2 Interpreter's Extender interface code
3 Name of Extender DLL
IntControl (11, p1, 0, 0, 0) (CP only)
Used to tell Command Post that it is (or is
not) a shell, contrary to what it really is.
That is, if it is really a shell, you can
disable the shell-like characteristics, or if
it is not a shell, enable its shell
characteristics.
39
WIL Update Manual
P1 Meaning
0 Play standard app
1 Play shell
IntControl (12, p1, 0, 0, 0) (WB only)
Used to direct WinBatch to allow itself to be
terminated without warning when Windows shuts
down and a batch file is still running
P1 Meaning
0 WinBatch complains on shutdown (default)
1 WinBatch will terminate quietly
IntControl (15, 0, 0, 0, 0) (WB only)
Returns currently executing WBT file name; the
same as the "paramfile" variable.
IntControl (18, 0, 0, 0, 0)
Suspends the program (WB or CP) waiting for
some other process to do the equivalent of
IntControl(19). This command will hang your
system if used improperly.
IntControl (19, p1, 0, 0, 0)
Un-suspends a process stopped with
IntControl(18). P1 is a window handle (not a
window title). Windows handles may be derived
from window titles using IntControl(21).
IntControl (20, 0, 0, 0, 0)
Returns window handle of current Command Post
or WinBatch window.
IntControl (21, p1, 0, 0, 0)
Returns window handle of window matching the
partial window-name in p1.
40
WIL Update Manual
IntControl (22, p1, p2, p3, p4)
Issues a Windows "SendMessage".
p1 Window handle to send to
p2 Message ID number (in decimal)
p3 wParam value
p4 assumed to be a character string.
String is copied to a GMEM_LOWER buffer, and
a LPSTR to the copied string is passed as
lParam. The GMEM_LOWER buffer is freed
immediately upon return from the SendMessage
IntControl (23, 0, 0, 0, 0)
Issues a windows PostMessage
p1 Window handle
p2 Message ID number (in decimal)
p3 wParam
p4 lParam -- assumed to be numeric
IntControl (66, 0, 0, 0, 0)
Restarts Windows, just like exiting to DOS and
typing WIN again. Could be used to restart
Windows after editing the SYSTEM.INI file to
change video modes.
IntControl (67, 0, 0, 0, 0)
Performs a warm boot of the system, just like
<Ctrl-Alt-Del>. Could be used to reboot the
system after editing the AUTOEXEC.BAT or
CONFIG.SYS files.
Note: IntControl(67) works only in Windows 3.1
or higher. In Windows 3.0, it behaves just
like IntControl(66) and restarts Windows.
IsKeyDown*
Tells about keys/mouse.
41
WIL Update Manual
Syntax:
IsKeyDown(keycodes)
Parameters:
(i) keycodes @SHIFT and/or @CTRL.
Returns:
(i) @YES if the key is down.
@NO if the key is not down.
Determines if the Shift key or the Ctrl key is
currently down.
Note: The right mouse button is the same as
Shift, and the middle mouse button is the same
as Ctrl.
Examples:
IsKeyDown(@SHIFT)
IsKeyDown(@CTRL)
IsKeyDown(@CTRL | @SHIFT)
IsKeyDown(@CTRL & @SHIFT)
See Also:
WaitForKey
IsLicensed*
Tells if the WIL Interpreter is licensed.
Syntax:
IsLicensed ( )
Parameters:
(none)
42
WIL Update Manual
Returns:
(i) @YES if current version of the WIL
Interpreter is licensed.
@NO if current version of the WIL
Interpreter is not licensed.
Returns information on whether or not the
current version of the WIL Interpreter is a
licensed copy.
Example:
IsLicensed()
See Also:
Version
ItemCount*
Returns the number of items in a list.
Syntax:
ItemCount (list, delimiter)
Parameters:
(s) list a string containing a list of items
to choose from.
(s) delimiter a string containing the
character to act as delimiter
between items in the list.
Returns:
(i) the number of items in the list.
If you create the list with the FileItemize or
DirItemize functions you will be using a space-
delimited list. WinItemize, however, creates a
tab-delimited list of window titles since
titles can have embedded blanks.
43
WIL Update Manual
Example:
a = FileItemize("*.*")
n = ItemCount(a, " ")
Message("Note", "There are %n% files")
See Also:
DirItemize, FileItemize, WinItemize,
ItemExtract, ItemSelect
ItemExtract*
Returns the selected item from a list.
Syntax:
ItemExtract (select, list, delimiter)
Parameters:
(i) select the position in "list" of the
item to be selected.
(s) list a string containing a list of items
to choose from.
(s) delimiter a string containing the
character to act as delimiter
between items in the list.
Returns:
(s) the selected item.
If you create the list with the FileItemize or
DirItemize functions you will be using a space-
delimited list. WinItemize, however, creates a
tab-delimited list of window titles since
titles can have embedded blanks.
44
WIL Update Manual
Example:
bmpfiles = FileItemize("*.bmp")
bmpcount = ItemCount(bmpfiles, " ")
pos = (Random(bmpcount - 1)) + 1
paper = ItemExtract(pos, bmpfiles, " ")
Wallpaper(paper, @FALSE)
See Also:
DirItemize, FileItemize, WinItemize,
ItemCount, ItemSelect
MouseInfo
Returns assorted mouse information.
Syntax:
MouseInfo (request#)
Parameters:
(i) request# see below.
Returns:
(s) see below.
The information returned by MouseInfo depends
on the value of request#.
Req# Return value
0 Window name under mouse
1 Top level parent window name under mouse
2 Mouse coordinates, assuming a 1000x1000
virtual screen
3 Mouse coordinates in absolute numbers
4 Status of mouse buttons, as a bitmask:
BinaryDecimal Meaning
000 0 No buttons down
001 1 Right button down
45
WIL Update Manual
010 2 Middle button down
011 3 Right and Middle buttons
down
100 4 Left button down
101 5 Left and Right buttons
down
110 6 Left and Middle buttons
down
111 7 Left, Middle, and Right
buttons down
For example, if mouse is at the center of a
640x480 screen and above the "Clock" window,
and the left button is down, the following
values would be returned:
Req# Return value
1 "Clock"
2 "500 500"
3 "320 240"
4 "4"
Example:
Display(1, "", "Press a mouse button to
continue")
:loop
buttons = MouseInfo(4)
If buttons == 0 Then Goto loop
If buttons & 4 Then Display(1, "", "Left
button was pressed")
If buttons & 1 Then Display(1, "", "Right
button was pressed")
See Also:
WinMetrics, WinParmGet
46
WIL Update Manual
NetAddCon
Connects network resources to imaginary local
disk drives or printer ports.
Syntax:
NetAddCon (net-path, password, local-name)
Parameters:
(s) net-path net resource or string returned
by NetBrowse.
(s) password password required to access
resource, or "".
(s) local-name local drive name or printer
port.
Returns:
(i) @TRUE if successful; @FALSE if
unsuccessful.
You can use NetAddCon to connect a local drive
to a network directory, in which case "local-
name" will be a drive name (eg, "Z:"). You can
also connect a local printer port to a network
print queue, in which case "local-name" will be
the name of the printer port (eg, "LPT1").
Use the NetBrowse function to obtain a value
for "net-path".
If no password is required, use a null string
("") for the "password" parameter.
47
WIL Update Manual
Example:
availdrive = DiskScan(0)
drvlen = StrLen(availdrive)
If drvlen == 0 Then Goto nomore
availdrive = StrSub(availdrive, drvlen - 2, 2)
netpath = NetBrowse(0)
pswd = AskPassword("Enter password for",
netpath)
NetAddCon(netPath, pswd, availdrive)
Exit
:nomore
Message("Connect Drive to Net", "No drives
avail for assignment")
See Also:
NetBrowse, NetCancelCon, NetGetCon
NetBrowse
Displays a dialog box allowing the user to
select a network resource.
Syntax:
NetBrowse (request#)
Parameters:
(i) request# see below.
Returns:
(s) see below.
Displays a dialog box allowing the user to
select a network resource. Request#=0 allows
selection of a network directory and
Request#=1 allows selection of a print queue.
This function returns a string that can be used by
NetAddCon to add a connection.
48
WIL Update Manual
Example:
availdrive = DiskScan(0)
drvlen = StrLen(availdrive)
If drvlen == 0 Then Goto nomore
availdrive = StrSub(availdrive, drvlen - 2, 2)
netpath = NetBrowse(0)
pswd = AskPassword("Enter password for",
netpath)
NetAddCon(netPath, pswd, availdrive)
Exit
:nomore
Message("Connect Drive to Net", "No drives
avail for assignment")
See Also:
NetAddCon
NetCancelCon
Breaks a network connection.
Syntax:
NetCancelCon (name, force)
Parameters:
(s) name network resource name or local name.
(i) force force flag (see below).
Returns:
(i) @TRUE if successful; @FALSE if
unsuccessful.
If "force" is set to 0, NetCancelCon will not
break the connection if any files on that
connection are still open. If "force" is set
to 1, the connection will be broken regardless.
49
WIL Update Manual
Example:
availdrive = DiskScan(4)
n = ItemCount(availdrive, " ")
If n == 0 Then Exit
i = 1
dislist = ""
:loop
drv = ItemExtract(i, availdrive, " ")
dislist = StrCat(drv, Num2Char(9),
NetGetCon(drv), "|")
i = i + 1
If i < n Then Goto loop
availdrive = ItemSelect("Disconnect", dislist,
"|")
NetCancelCon(availdrive, 0)
See Also:
NetAddCon, NetGetCon
NetDialog
Brings up the network driver's dialog box.
Syntax:
NetDialog ( )
Parameters:
(none)
Returns:
(i) @TRUE if successful; @FALSE if
unsuccessful.
A network driver's dialog box displays
copyright information, and may allow access to
the network, depending on the particular
network driver. The WIL program will wait
until the network dialog terminates before
continuing.
50
WIL Update Manual
Example:
NetDialog()
DiskUpdate()
See Also:
DiskReset, DiskUpdate
NetGetCaps
Returns information on network capabilities.
Syntax:
NetGetCaps (request#)
Parameters:
(i) request# see below.
Returns:
(i) see below.
NetGetCaps returns 0 if no network is installed
(it is the only network function you can use
without having a network installed and not get
an error).
Req# Return value
1 Network driver specification number
2 Type of network installed:
0 None
256 MS Network
512 Lan Manager
768 Novell NetWare
1024 Banyan Vines
1280 10 Net
(other) Other network
3 Network driver version number
51
WIL Update Manual
4 Returns 1 if any network is installed
6 Bitmask indicating whether the network
driver supports the following
connect functions:
1 AddConnection
2 CancelConnection
4 GetConnection
8 AutoConnect via DOS
16 BrowseDialog
7 Bitmask indicating whether the network
driver supports the following
print functions:
2 Open Print Job
4 Close Print Job
16 Hold Print Job
32 Release Print Job
64 Cancel Print Job
128 Set number of copies
256 Watch Print Queue
512 Unwatch Print Queue
1024 Lock Queue Data
2048 Unlock Queue Data
4096 Driver will send QueueChanged
messages to Print Manager
8192 Abort Print Job
Example:
caps = NetGetCaps(6)
If caps & 16 Then Message("", "Your network
supports BrowseDialog")
See Also:
NetGetUser, WinConfig, WinMetrics, WinParmGet
NetGetCon
Returns the name of a connected network
resource.
52
WIL Update Manual
Syntax:
NetGetCon (local-name)
Parameters:
(s) local-name local drive name or printer
port.
Returns:
(s) name of network resource.
NetGetCon returns the name of the network
resource currently connected to "local-name".
Example:
local = AskLine("NetGetCon", "Enter local
drive name", "")
If local == "" Then Exit
resource = NetGetCon(local)
Message("NetGetCon", "%local% is connected to
%resource%")
See Also:
NetAddCon, NetCancelCon
NetGetUser
Returns the name of the user currently logged
into the network.
Syntax:
NetGetUser ( )
Parameters:
(none)
Returns:
(s) name of current user.
53
WIL Update Manual
Example:
IniWritePvt("Current Users", "Excel",
NetGetUser(), "usagelog.ini")
Run("excel.exe", "")
See Also:
NetGetCaps
ParseData*
Parses the passed string.
Syntax:
ParseData (string)
Parameters:
(s) string string to be parsed.
Returns:
(i) number of parameters in "string".
This function breaks a string constant or
string variable into new sub-string variables
named param1, param2, etc. (maximum of nine
parameters). Blank spaces in the original
string are used as delimiters to create the new
variables.
Param0 is the count of how many sub-strings are
found in "string".
Example:
username = AskLine("Hello", "Please enter your
name","")
ParseData(username)
If the user enters:
Joe Q. User
54
WIL Update Manual
ParseData would create the following variables:
param1 == Joe
param2 == Q.
param3 == User
param0 == 3
See Also:
ItemExtract, StrSub
PlayMedia
Controls multimedia devices.
Syntax:
PlayMedia (command-string)
Parameters:
(s) command-string string to be sent to the
multimedia device.
Returns:
(s) response from the device.
If the appropriate Windows multimedia
extensions are present, this function can
control multimedia devices. Valid command
strings depend on the multimedia devices and
drivers installed. The basic Windows
multimedia package has a waveform device to
play and record waveforms, and a sequencer
device to play MID files. Refer to the
appropriate documentation for information on
command strings.
Many multimedia devices accept the WAIT or
NOTIFY parameters as part of the command
string:
55
WIL Update Manual
WAIT Causes the system to stop processing
input until the requested operation
is complete. You cannot switch tasks
when WAIT is specified.
NOTIFY Causes the WIL program to suspend
execution until the requested operation
completes. You can perform other tasks
and switch between tasks when NOTIFY is
specified.
WAIT NOTIFY Same as WAIT
If neither WAIT nor NOTIFY is specified, the
multimedia operation is started and control
returns immediately to the WIL program.
In general, if you simply want the WIL program
to wait until the multimedia operation is
complete, use the NOTIFY keyword. If you want
the system to hang until the operation is
complete, use WAIT. If you just want to start
a multimedia operation and have the program
continue processing, don't use either keyword.
The return value from PlayMedia is whatever
string the driver returns. This will depend on
the particular driver, as well as on the type
of operation performed.
56
WIL Update Manual
Example:
; Plays a music CD on a CDAudio player. It
plays whatever is in the
; drive, from start to finish
stat = PlayMedia("status cdaudio mode")
answer = 1
If stat == "playing" Then answer =
AskYesNo("CD Audio", "CD is
Playing. Stop?")
If answer == 0 Then Exit
PlayMedia("open cdaudio shareable alias donna
notify")
PlayMedia("set donna time format tmsf")
PlayMedia("play donna from 1")
PlayMedia("close donna")
Exit
:cancel
PlayMedia("set cdaudio door open")
See Also:
Playmidi, PlayWaveForm
PlayMidi
Plays a MID or RMI sound file.
Syntax:
PlayMidi (filename, mode)
Parameters:
(s) filename name of the MID or RMI sound
file.
(i) mode play mode (see below).
Returns:
(i) @TRUE if successful; @FALSE if
unsuccessful.
If Windows multimedia sound extensions are
present, and MIDI-compatible hardware is
57
WIL Update Manual
installed, this function will play a MID or RMI
sound file. If "filename" is not in the
current directory and a directory is not
specified, the path will be searched to find
the file.
If "mode" is set to 0, the WIL program will
wait for the sound file to complete before
continuing. If "mode" is set to 1, it will
start playing the sound file and continue
immediately.
Example:
PlayMidi("canyon.mid", 1)
See Also:
PlayMedia, PlayWaveForm
PlayWaveForm
Plays a WAV sound file.
Syntax:
PlayWaveForm (filename, mode)
Parameters:
(s) filename
(i) mode play mode (see below).
Returns:
(i) @TRUE if successful; @FALSE if
unsuccessful.
If Windows multimedia sound extensions are
present, and waveform-compatible hardware is
installed, this function will play a WAV sound
file. If "filename" is not in the current
directory and a directory is not specified, the
path will be searched to find the file. If
58
WIL Update Manual
"filename is not found, the WAV file associated
with the "SystemDefault" keyword is played,
(unless the "NoDefault" setting is on).
Instead of specifying an actual filename, you
may specify a keyword name from the [Sound]
section of the WIN.INI file (eg,
"SystemStart"), in which case the WAV file
associated with that keyword name will be
played.
"Mode" is a bitmask, composed of the following
bits:
Mode Meaning
0 Wait for the sound to end before
continuing.
1 Don't wait for the sound to end. Start
the sound and immediately process more
statements.
2 If sound file not found, do not play a
default sound
9 Continue playing the sound forever, or
until a PlayWaveform("", 0) statement is
executed
16 If another sound is already playing, do
not interrupt it. Just ignore this
PlaySound request.
You can combine these bits using the binary OR
operator.
The command PlayWaveForm("", 0) can be used at
any time to stop sound.
Examples:
PlayWaveForm("tada.wav", 0)
PlayWaveForm("SystemDefault", 1 | 16)
59
WIL Update Manual
See Also:
PlayMedia, Playmidi
SendKey*
Sends keystrokes to the active application.
Syntax:
SendKey (char-string)
Parameters:
(s) char-string string of regular and/or
special characters.
Returns:
(i) always 0.
This function is used to send keystrokes to the
current window, just as if they had been
entered from the keyboard. Any alphanumeric
character, and most punctuation marks and other
symbols which appear on the keyboard, may be
sent simply by placing it in the "char-string."
In addition, the following special characters,
enclosed in "curly" braces, may be placed in
"char-string" to send the corresponding special
characters:
Key SendKey equivalent
~ {~}
! {!}
^ {^}
+ {+}
Backspace {BACKSPACE} or {BS}
Delete {DELETE} or {DEL}
Down Arrow {DOWN}
End {END}
Enter {ENTER} or ~
Escape {ESCAPE} or {ESC}
60
WIL Update Manual
F1 through F12 {F1} through {F12}
Home {HOME}
Insert {INSERT}
Left Arrow {LEFT}
Page Down {PGDN}
Page Up {PGUP}
Right Arrow {RIGHT}
Space {SPACE} or {SP}
Tab {TAB}
Up Arrow {UP}
To enter an Alt, Control, or Shift key
combination, precede the desired character with
one or more of the following symbols:
Alt !
Control ^
Shift +
To enter Alt-S:
SendKey("!S")
To enter Ctrl-Shift-F7:
SendKey("^+{F7}")
You may also repeat a key by enclosing it in
braces, followed by a space and the total
number of repetitions desired.
To type 20 asterisks:
SendKey("{* 20}")
To move the cursor down 8 lines:
SendKey("{DOWN 8}")
It is possible to use SendKey to send
keystrokes to a DOS application, but only if
you are running Windows in 386 Enhanced mode.
You would then transfer the keystrokes to the
DOS application via the Clipboard. It is only
61
WIL Update Manual
possible to send standard ASCII characters to
DOS applications; you cannot send function key
or Alt-key combinations.
Examples:
; Start Notepad, and use *.* for filenames
Run("notepad.exe", "")
SendKey("!FO*.*~")
; run DOS batch file which starts our editor
Run("edit.bat", "")
; wait 15 seconds for editor to load
Delay(15)
; send string (with carriage return) to the
clipboard
crlf = StrCat(Num2Char(13), Num2Char(10))
ClipPut("Hello%crlf%")
; paste contents of clipboard to DOS window
SendKey("!{SP}EP")
See Also:
SKDebug
SKDebug*
Controls how SendKey works
Syntax:
SKDebug (mode)
Parameters:
(i) mode @OFF Keystrokes sent to
application. No debug file
written. Default mode.
@ON Keystrokes sent to application.
Debug file written.
@PARSEONLY Keystrokes not sent to
application. Debug file
written.
62
WIL Update Manual
Returns:
(i) previous SKDebug mode.
This function allows you to direct the
keystrokes generated by your SendKey statements
to a disk file in addition to, or instead of,
the application window. Normally, keystrokes
are sent only to the application. If you
specify SKDebug (@ON), keystrokes are sent to a
disk file as well as to the application. If
you specify SKDebug (@PARSEONLY), keystrokes
are sent only to the disk file, and not to the
application. SKDebug (@OFF) returns to the
default mode.
By default, the file which will receive the
parsed keystrokes is named C:\@@SKDBUG.TXT.
You can override this by making an entry in the
WWW-PROD.INI file, under the heading(s)
[CmdPost] and/or [WinBatch] (depending on which
of these program[s] you are using), as follows:
SKDFile=debug.fil
where debug.fil is the filename, including
complete path specification, that you want to
receive the keystrokes.
Example:
Run("notepad.exe", "")
SKDebug(@ON)
SendKey("!FO*.*~")
SKDebug(@OFF)
See Also:
SendKey
63
WIL Update Manual
SnapShot
Takes a snapshot of the screen and pastes it to
the clipboard.
Syntax:
SnapShot (request#)
Parameters:
(i) request# see below.
Returns:
(i) always 0.
Req# Meaning
0 Take snapshot of entire screen
1 Take snapshot of client area of parent
window of active window
2 Take snapshot of entire area of parent
window of active window
3 Take snapshot of client area of active
window
4 Take snapshot of entire area of active
window
Example:
SnapShot(2)
See Also:
ClipPut
Sounds
Turns sounds on or off.
Syntax:
Sounds (request#)
64
WIL Update Manual
Parameters:
(i) request# see below.
Returns:
(i) previous Sound setting.
If Windows multimedia sound extensions are
present, this function turns sounds made by the
WIL Interpreter on or off. Specify a request#
of 0 to turn sounds off, and a request# of 1 to
turn them on. By default, the WIL Interpreter
makes noise.
Example:
Sounds(0)
StrReplace*
Replaces all occurances of a substring with
another.
Syntax:
StrReplace (string, old, new)
Parameters:
(s) string string in which to search.
(s) old target substring.
(s) new replacement substring.
Returns:
(s) updated "string", with "old"
replaced by "new".
StrReplace scans the "string", searching for
occurrences of "old" and replacing each
occurrence with "new".
65
WIL Update Manual
Example:
; Copy all INI files to clipboard
a = FileItemize("*.ini")
crlf = StrCat(Num2Char(13), Num2Char(10))
b = StrReplace(a, " ", crlf)
ClipPut(b)
See Also:
StrIndex, StrScan, StrSub
TextSelect
Allows the user to choose an item from an
unsorted listbox.
Syntax:
TextSelect (title, list, delimiter)
Parameters:
(s) title the title of dialog box to display.
(s) list a string containing a list of items
to choose from.
(s) delimiter a string containing the
character to act as delimiter
between items in the list.
Returns:
(s) the selected item.
This function displays a dialog box with a
listbox inside. This listbox is filled with an
unsorted list of items taken from a string you
provide to the function.
Each item in the string must be separated
(delimited) by a character, which you also pass
to the function.
The user selects one of the items by either
doubleclicking on it, or single-clicking and
pressing OK. The item is returned as a string.
66
WIL Update Manual
If you create the list with the FileItemize or
DirItemize functions you will be using a space-
delimited list. WinItemize, however, creates a
tab-delimited list of window titles since
titles can have embedded blanks.
TextSelect is like ItemSelect, except that with
TextSelect the displayed box is larger and the
items in the box are not sorted alphabetically.
Example:
DirChange(DirWindows(0))
inifiles = FileItemize("*.ini")
ini = TextSelect("Select an INI file to edit",
inifiles, " ")
If ini == "" Then Exit
RunZoom("notepad.exe", ini)
See Also:
AskLine, DirItemize, FileItemize, ItemSelect,
TextBox, WinItemize
WaitForKey
Waits for a specific key to be pressed.
Syntax:
WaitForKey (key1, key2, key3, key4, key5)
Parameters:
(s) key1 - key5 five keystrokes to
wait for.
Returns:
(i) position of the selected
keystroke (1-5).
WaitForKey requires five parameters, each of
which represents a keystroke (refer to the
67
WIL Update Manual
SendKey function for a list of special keycodes
which can be used). The WIL program will be
suspended until one of the specified keys are
pressed, at which time the WaitForKey function
will return a number from 1 to 5, indicating
the position of the "key" that was selected,
and the program will continue. You can specify
a null string ("") for one or more of the "key"
parameters if you don't need to use all five.
WaitForKey will detect its keystrokes in most,
but not all, Windows applications. Any
keystroke that is pressed is also passed on to
the underlying application.
Example:
k = WaitForKey("{F11}", "{F12}", "{INSERT}",
"", "")
If k == 1 Then Message("WaitForKey", "You
pressed the F11 key")
If k == 2 Then Message("WaitForKey", "You
pressed the F12 key")
If k == 3 Then Message("WaitForKey", "You
pressed the Insert key")
See Also:
IsKeyDown
WallPaper*
Changes the Windows wallpaper.
Syntax:
WallPaper (bmp-name, tile)
Parameters:
(s) bmp-name Name of the BMP wallpaper file.
(i) tile @TRUE if wallpaper should be tiled.
68
WIL Update Manual
@FALSE if wallpaper should not be
tiled.
Returns:
(i) always 0
This function immediately changes the Windows
wallpaper. It can even be used for wallpaper
"slide shows."
Example:
DirChange("c:\windows")
a = FileItemize("*.bmp")
a = ItemSelect("Select New paper", a, " ")
tile = @FALSE
If FileSize(a) < 40000 Then tile = @TRUE
Wallpaper(a, tile)
See Also:
WinParmSet
WinConfig*
Returns WIN3 mode flags.
Syntax:
WinConfig ( )
Parameters:
(none)
Returns:
(i) sum of Windows configuration bits.
Returns Windows configuration information as a
number, which is the sum of the following
individual bits:
69
WIL Update Manual
1 Protected Mode
2 80286 CPU
4 80386 CPU
8 80486 CPU
16 Standard Mode
32 Enhanced Mode
64 8086 CPU
128 80186 CPU
256 Large PageFrame
512 Small PageFrame
1024 80x87 Installed
You will need to use bitwise operators to
extract the individual bits.
Examples:
cfg = WinConfig()
If cfg & 32 Then Display(2, "Windows Mode",
"Enhanced Mode")
If cfg & 16 Then Display(2, "Windows Mode",
"Standard Mode")
If !(cfg & 1) Then Display(2, "Windows Mode",
"Real Mode")
cfg = WinConfig()
If cfg & 1024 Then Display(2, "Math co-
processor", "Yes")
If !(cfg & 1024) Then Display(2, "Math co-
processor", "No")
See Also:
NetGetCaps, WinMetrics, WinParmGet,
WinResources
WinExeName
Returns the name of the executable file which
created a specified window.
70
WIL Update Manual
Syntax:
WinExeName (partial-windowname)
Parameters:
(s) partial-windowname the initial part
of, or an entire, window name.
Returns:
(s) name of the EXE file.
Returns the name of the EXE file which created
the first window found whose title matches
"partial-windowname".
"Partial-windowname" is the initial part of a
window name, and may be a complete window name.
It is case-sensitive. You should specify
enough characters so that "partial-windowname"
matches only one existing window.
Example:
prog = WinExeName("WinCheck")
WinClose("WinCheck")
Delay(5)
Run(prog, "")
See Also:
Run, WinExist, WinGetActive, WinName
WinExist*
Tells if specified window exists.
Syntax:
WinExist (partial-windowname)
Parameters:
(s) partial-windowname the initial part
of, or an entire, window name.
71
WIL Update Manual
Returns:
(i) @TRUE if a matching window
is found.
@FALSE if a matching window
is not found.
Note: The partial window name you give must
match the initial portion of the window name
(as appears in the title bar) exactly,
including proper case (upper or lower) and
punctuation.
Example:
If WinExist("Clock") == @FALSE Then
RunIcon("Clock", "")
See Also:
WinActivate, WinClose, WinGetActive,
WinItemize, WinState
WinMetrics
Returns Windows system information.
Syntax:
WinMetrics (request#)
Parameters:
(i) request# see below.
Returns:
(i) see below.
The request# parameter determines what piece of
information will be returned.
72
WIL Update Manual
Req# Return value
-1 Number of colors supported by video
driver
0 Width of screen, in pixels
1 Height of screen, in pixels
2 Width of arrow on vertical scrollbar
3 Height of arrow on horizontal scrollbar
4 Height of window title bar
5 Width of window border lines
6 Height of window border lines
7 Width of dialog box frame
8 Height of dialog box frame
9 Height of thumb box on scrollbar
10 Width of thumb box on scrollbar
11 Width of an icon
12 Height of an icon
13 Width of a cursor
14 Height of a cursor
15 Height of a one line menu bar
16 Width of full screen window
17 Height of a full screen window
18 Height of Kanji window (Japanese)
19 Is a mouse present (0 = No, 1 = Yes)
20 Height of arrow on vertical scrollbar
21 Width of arrow on horizontal scrollbar
22 Is debug version of Windows running (0 =
No, 1 = Yes)
23 Are Left and Right mouse buttons swapped
(0 = No, 1 = Yes)
24 Reserved
25 Reserved
26 Reserved
27 Reserved
28 Minimum width of a window
29 Minimum height of a window
30 Width of bitmaps in title bar
31 Height of bitmaps in title bar
32 Width of sizeable window frame
33 Height of sizeable window frame
34 Minimum tracking width of a window
35 Minimum tracking height of a window
Example:
73
WIL Update Manual
mouse = "NO"
If WinMetrics(19) == 1 Then mouse = "YES"
Message("Is there a mouse installed?", mouse)
See Also:
MouseInfo, NetGetCaps, WinConfig, WinParmGet,
WinResources
WinName
Returns the name of the current WIL Interpreter
window.
Syntax:
WinName ( )
Parameters:
(none)
Returns:
(s) window name.
Returns the name of the current WIL interpreter
(eg, Command Post or WinBatch) window.
Example:
tab = Num2Char(9)
allwins = WinItemize()
win = ItemSelect("Close window", allwins, tab)
If win == WinName() Then Goto nocando
WinClose(win)
Exit
:nocando
Message("Sorry", "I can't close myself")
See Also:
WinActivate, WinExeName, WinGetActive,
WinItemize, WinTitle
74
WIL Update Manual
WinParmGet
Returns system information.
*** This function required Windows 3.1 or higher
Syntax:
WinParmGet (request#)
Parameters:
(i) request# see below.
Returns:
(s) see below.
The request# parameter determines what piece of
information will be returned.
Req# Meaning Return value
75
WIL Update Manual
1 Beeping 0 = Off, 1 = On
2 Mouse sensitivity "threshold1 threshold2
speed"
3 Border Width Width in pixels
4 Keyboard Speed Keyboardbd Repeat rate
5 LangDriver name of LANGUAGE.DLL
6 Horiz. Icon Spacing Spacing in pixels
7 Screen Save Timeout Timeout in seconds
8 Is screen saver enabled 0 = No, 1 = Yes
9 Desktop Grid size Grid Size
10 Wallpaper BMP file BMP file name
11 Desktop Pattern Pattern codes (string
of 8 space-delimited nums.)
12 Keyboard Delay Delay in
milliseconds
13 Vertical Icon Spacing Spacing in pixels
14 IconTitleWrap0 = No, 1 = Yes
15 MenuDropAlign 0 = Right, 1
= Left
16 DoubleClickWidth Allowable horiz.
movement in pixels for DblClick
17 DoubleClickHeight Allowable vert.
movement in pixels for DblClick
18 DoubleClickSpeed Max time in millisecs
between clicks for DblClick
19 MouseButtonSwap 0 = Not swapped, 1 =
swapped
20 Fast Task Switch 0 = Off, 1 =
On
Example:
If WinParmGet(8) == 1 Then Message("", "Screen
saver is active")
See Also:
MouseInfo, NetGetCaps, WinConfig, WinMetrics,
WinParmSet, WinResources
76
WIL Update Manual
WinParmSet
Sets system information.
*** This function required Windows 3.1 or higher
Syntax:
WinParmSet (request#, new-value, ini-control)
Parameters:
(i) request# see WinParmGet
(s) new-value see WinParmGet
(i) ini-control see below.
Returns:
(int) previous value of the setting.
See WinParmSet for a list of valid request#'s
and values.
The "ini-control" parameter determines to what
extent the value gets updated:
0 Set system value in memory only for future
reference
1 Write new value to appropriate INI file
2 Broadcast message to all applications
informing them of new value
3 Both 1 and 2
Example:
WinParmSet(9, "2", 3) ; sets desktop grid
size to 2
See Also:
WallPaper, WinParmGet
WinPlaceGet
Returns window coordinates.
77
WIL Update Manual
Syntax:
WinPlaceGet (win-type, partial-windowname)
*** Requires WIndows 3.1 or higher
Parameters:
(i) win-type @ICON, @NORMAL, or
@ZOOMED
(s) partial-windowname the initial part
of, or an entire, window name.
Returns:
(s) window coordinates (see
below).
This function returns the coordinates for an
iconized, normal, or zoomed window.
"Partial-windowname" is the initial part of a
window name, and may be a complete window name.
It is case-sensitive. You should specify
enough characters so that "partial-windowname"
matches only one existing window. If it
matches more than one window, the most recently
accessed window which it matches will be used.
The returned value is a string of either 2 or 4
numbers, as follows:
Iconic windows "x y" (upper left
corner of the icon)
Normal windows "upper-x upper-y lower-x
lower-y"
Zoomed windows "x y" (upper left
corner of the window)
All coordinates are relative to a virtual
1000x1000 screen.
78
WIL Update Manual
Examples:
Run("clock.exe", "")
pos = WinPlaceGet(@NORMAL, "Clock")
Delay(2)
WinPlaceSet(@NORMAL, "Clock", "250 250 750
750")
Delay(2)
WinPlaceSet(@NORMAL, "Clock", pos)
See Also:
WinGetActive, WinItemize, WinPlaceSet,
WinPosition, WinState
WinPlaceSet
Sets window coordinates.
***Requires Windows 3.1 or higher
Syntax:
WinPlaceSet (win-type, partial-windowname,
position-string)
Parameters:
(i) win-type @ICON, @NORMAL, or
@ZOOMED
(s) partial-windowname the initial part of, or
an entire, window name.
(s) position-string window
coordinates (see below).
Returns:
(s) previous coordinates.
This function sets the coordinates for an
iconized, normal, or zoomed window. The window
does not have to be in the desired state to set
the coordinates; for example, you can set the
iconized position for a normal window so that
when the window is subsequently iconized, it
will go to the coordinates that you've set.
79
WIL Update Manual
"Partial-windowname" is the initial part of a
window name, and may be a complete window name.
It is case-sensitive. You should specify
enough characters so that "partial-windowname"
matches only one existing window. If it
matches more than one window, the most recently
accessed window which it matches will be used.
"Position-string" is a string of either 2 or 4
numbers, as follows:
Iconic windows "x y" (upper left
corner of the icon)
Normal windows "upper-x upper-y lower-x
lower-y"
Zoomed windows "x y" (upper left
corner of the window)
All coordinates are relative to a virtual
1000x1000 screen.
Examples:
WinPlaceSet(@ICON, "Clock", "10 950")
WinPlaceSet(@NORMAL, "Clock", "250 250 750
750")
WinPlaceSet(@ZOOMED, "Clock", "-5 -5")
See Also:
IconArrange, WinActivate, WinArrange,
WinPlace, WinPlaceGet, WinState
WinPosition*
Returns Window position.
Syntax:
WinPosition (partial-windowname)
80
WIL Update Manual
Parameters:
(s) partial-windowname the initial part
of, or an entire, window name.
Returns:
(s) window coordinates,
delimited by commas.
Returns the current window position information
for the selected window. It returns 4 comma-
separated numbers (see WinPlace for details).
Example:
Run("clock.exe", "") ; start Clock
WinPlace(0,0,300,300, "Clock") ; place
Clock
pos = WinPosition("Clock") ; save position
delay(2)
WinPlace(200,200,300,300, "Clock") ; move
Clock
delay(2)
WinPlace(%pos%, "Clock") ; restore Clock
See Also:
WinGetActive, WinItemize, WinPlace,
WinPlaceGet, WinState
WinResources
Returns information on available memory and
resources.
Syntax:
WinResources (request#)
Parameters:
(i) request# see below
81
WIL Update Manual
Returns:
(i) see below.
The value of request# determined the piece of
information returned.
Req# Return value
0 Total available memory, in bytes
1 Theoretical maximum available memory, in
bytes
2 Percent of free system resources (lower
of GDI and USER)
3 Percent of free GDI resources
4 Percent of free USER resources
Example:
mem = WinResources(0)
Message("Available memory", "%mem% bytes")
See Also:
WinConfig, WinMetrics, WinParmGet
WinState
Returns the current state of a window.
Syntax:
WinState (partial-windowname)
Parameters:
(s) partial-windowname the initial part
of, or an entire, window name.
Returns:
(i) window state (see below).
"Partial-windowname" is the initial part of a
window name, and may be a complete window name.
82
WIL Update Manual
It is case-sensitive. You should specify
enough characters so that "partial-windowname"
matches only one existing window. If it
matches more than one window, the most recently
accessed window which it matches will be used.
Possible return values are as follows.
Value Symbolic name Meaning
-1 @HIDDEN Specified window exists,
but is hidden
0 @FALSE Specified window does not
exist
1 @ICON Specified window is iconic
(minimized)
2 @NORMAL Specified window is a
normal window
3 @ZOOMED Specified window is zoomed
(maximized)
Example:
If WinState("Notepad") == @ICON Then
WinShow("Notepad")
See Also:
Run, WinExist, WinGetActive, WinHide,
WinIconize, WinItemize, WinPlace,
WinPlaceGet, WinPlaceSet, WinPosition,
WinShow, WinZoom
83
WIL Update Manual
OTHER FEATURES
Changes to both Command Post and WinBatch
:CANCEL
With previous versions of Command Post and
WinBatch, one of the problems was that if the
user pressed the Cancel button in a dialog box,
processing terminated immediately. Now, if the
user presses the Cancel button, the label
:CANCEL will be searched for in the WIL
program, and, if found, control will be
transferred there. If no label :CANCEL is
found, processing simply stops (like it did
before).
This allows the programmer to perform various
bits of cleanup processing after a user presses
Cancel.
Default program for unknown extension
It is difficult to set up file "associations"
(the [Extensions] section of the WIN.INI file)
for all the possible file extensions that one
might ever encounter. Users often simply want
a way to view a file with an unknown extension,
in order to examine or identify its contents.
With this in mind, Command Post and WinBatch
will now search for an asterisk (*) in the
[Extensions] section of the WIN.INI file, if
84
WIL Update Manual
there is no explicit entry for the desired
file's extension.
This is useful, especially in Command Post,
when you can now double click on a random file,
like README.1ST, and have something happen. To
make something happen:
In the [Extensions] section of the WIN.INI
file add a line such as:
*=browser.exe
Then, whenever a file is double clicked in
Command Post, and the extension is not
recognized, Command Post will pass the file to
Browser. Note that the customary ^.ext is not
included in the line above.
In WinBatch, this feature comes into play when
the program attempts to process a command like
the following:
Run("readme.1st", "")
This would be translated to:
Run("browser.exe", "readme.1st")
Better program launch diagnostics
In earlier versions of Command Post and
WinBatch, if, for some obscure reason, a
program could not be launched, Command Post and
WinBatch either simply beeped, put up a "Cannot
Run" message, or ignored the situation -- not
exactly conducive to helping the user figure
out what went wrong. The new versions now put
up more detailed error messages to assist the
user in fixing the problem.
85
WIL Update Manual
New INI file
All of the Command Post and WinBatch items that
were previously stored in the WIN.INI file have
been moved to the WWW-PROD.INI file.
Improved Display function
If the Display command is cancelled, either by
a mouse click or by a keystroke, it returns
@TRUE; otherwise, it returns @FALSE. Also,
Display can now display a message for up to
3600 seconds, rather than the previous limit of
15 seconds.
Longer Delay
The Delay function now has a maximum limit of
3600 seconds, rather than the previous limit of
15 seconds.
Change in DialogBox
The DialogBox function (new in Command Post)
has been modified to require that a file name
be selected if a file list box is in the dialog
box. However, this behavior may be altered
using IntControl(4), which will allow a
directory only to be returned (like it did
before, in WinBatch).
Partial windowname option
Functions that accept a partial windowname
(like WinShow("Clo")) can now be directed to
only accept an exact match, just by ending the
86
WIL Update Manual
window name with a tilde ( ~ ). For example,
WinShow("Clock~")
Improved StrTrim
The StrTrim function has been modified to now
remove tabs, as well as spaces, from the
beginning and end of a string.
Noise
Sounds have been added to Command Post and
WinBatch dialog boxes. If you have the
Multimedia extensions and hardware capable of
playing WAV waveform files, sounds will sound
at various points in the execution of Command
Post and WinBatch. Sounds are on by default.
Sounds(@OFF) can be used to turn the sounds
off.
In addition, if you add to the [Sounds] section
of your WIN.INI file a line like:
StartProgram=CHIMES.WAV,Program Launch
then Command Post and WinBatch will make sounds
whenever a new program is launched. Some
people seem to like BEAMUP.WAV, which is the
sound that occurs when the SS Enterprise's
transporter is energized.
FileOpen error message
The error message returned when the FileOpen
command fails has been changed from 3077 (a
fatal error) to 1077 (a minor error, which can
therefore be trapped).
87
WIL Update Manual
Changes to Command Post only
Hotkeys
Hotkeys can now be assigned to any menu item,
and will cause the menu item to be executed
when the hotkey is pressed. Most single keys
and key combinations may be used as hotkeys,
with the exception of ALT and ALT-SHIFT key
combinations (although you may use ALT-CTRL
combinations), and with the exception of the
F10 key. Refer to SendKey for a list of
special keycodes which may be used.
To assign a hotkey to a menu item, place a
backslash after the drop-down menu item,
followed by the hotkey definition. For
example:
Stuff
Start Clock \ ^+C
Run("CLOCK.EXE", "")
Get Phonebook \ ^+P
DirChange("C:\NOTES")
Run("CARDFILE.EXE", "PHONES.CRD")
Games
Solitaire \ {F2}
Run("SOL.EXE", "")
Reversi \ {F3}
Run("REVERSI.EXE", "")
Note that you can override some of Command
Post's built in functions by using hotkeys.
For example, if you assign ^C as a menu item
hotkey, you will no longer be able to change to
the C drive by pressing ^C.
Multiple menu levels
Previous versions of Command Posts allowed only
a single level of drop-down menus. Command
88
WIL Update Manual
Post now supports any combination of the
following:
1. Immediate execution menu items. Select the
item from the menu bar and it gets executed.
No drop-down menus appear.
2. Single level drop-down items. These are
what Command Post always did.
3. Double level drop-down items - When a
Single level drop-down menu item is selected,
even more menu items can appear in a new drop-
down menu.
4. Triple level drop-down items - When a
Double level drop-down menu item is selected,
even more menu items can appear in yet another
new drop-down menu.
Window placement on startup
Command Post now saves considerable time on
startup of both the initial window and
subsequent Command Post windows (up to four),
by automatically sizing and placing them based
upon parameters stored in the WWW-PROD.INI
file.
Terminate Windows option
There is now an option to terminate Windows
when the last Command Post window closes. This
was implemented so that Command Post could, if
desired, behave like other shells. This option
is controlled by using IntControl(11).
89
WIL Update Manual
File attribute display
File attributes are now displayed when in the
Long view mode.
Hidden and System files
Hidden and System files can now be displayed.
This option is controlled by using
IntControl(5).
Parent directory (dot dot)
Added a ".." directory at the top of the
Command Post file display. You can double-
click on the ".." to move up one directory
level (but you cannot highlight it for use in
directory operations).
Program run options
Ctrl-Enter (or Ctrl-DoubleClick will run a
selected file zoomed. Shift-Enter (or Shift-
DoubleClick) will run a selected file
minimized.
Non-displayed menu items
If the first character of a Command Post menu
item is a @, the item is not displayed on the
menu. This can be useful if you have a hotkey
assigned to the item, and thus have no need to
actually select it from the menu.
90
WIL Update Manual
DIALOG BOXES
For each dialog box, you must first create a
template file, with a (recommended) WBD
extension, which will identify the structure of
the dialog box, as well as the variables used
by it. Unlike the other WIL functions, you do
not actually pass variables to DialogBox as
parameters. However, the DialogBox function
does indeed have the ability to manipulate, and
even create, variables. If you are familiar
with programming, you may think of DialogBox as
a subroutine, and all the variables it uses as
being global.
Let's start with a simple example. Suppose we
want to write a WIL program which starts up
Notepad, with two options which can be selected
at runtime:
Here's what the template file will look like:
[zoom+1Start editor zoomed]
[backup+1Save backup of file]
It is an ordinary ASCII file.
Some explanation is in order. First, note the
square brackets. Each element in a WBD file is
enclosed in brackets; in this case, there are
two distinct elements. Next, notice that the
first items that appear inside the brackets are
variable names -- in this case, zoom and
backup. Immediately following the variable
name is a plus sign (+), which identifies the
elements as being check boxes. After the +
symbol is the number 1, which represents the
value that will be assigned to the variable if
the box gets checked. Note that there is no
91
WIL Update Manual
space before or after the + symbol. Finally,
we have the text which will be displayed next
to the check box.
Now, let's create the WIL program file which
will use this WBD template:
file = ItemSelect("", FileItemize("*.*"), " ")
DialogBox("Edit a file", "edit.wbd")
If backup == 0 Then Goto nobackup
filebackupname = StrCat(FileRoot(file), ".",
"bak")
FileCopy(file, filebackupname, @TRUE)
:nobackup
If zoom == 1 Then Run("notepad.exe", file)
If zoom == 1 Then RunZoom("notepad.exe", file)
The WBD template file should be in the current
directory or in a directory on your path;
otherwise, you must give a complete path
specification for it when it appears in the
DialogBox statement.
Now, run the WIL program. See how the lines in
the template file got translated to fields in
the dialog box. Also notice the two buttons
that were added at the bottom -- OK and Cancel.
Cancel terminates the WIL program entirely.
You may want to try running this with various
combinations of boxes checked, just to confirm
that it works properly. It should.
Now, look again at the WIL program. Notice how
the variables zoom and backup do not appear
until after the DialogBox statement. In
essence, these variables are created by the WBD
template, and initialized with values of 0. If
the user checks a box, the variable associated
with that box is given the value which appears
next to the + symbol in the template. So, if
the first box is checked, then zoom will have a
value of 1 after the DialogBox statement is
executed. If it remains un-checked, it will
92
WIL Update Manual
still have a value of 0. These values can then
be used in your WIL program, as we have done
above.
Suppose that you want a box to be checked, by
default. All you need to do is to assign a
non-zero value to the corresponding variable
before you execute the DialogBox statement.
For example:
file = ItemSelect("", FileItemize("*.*"), " ")
zoom = 1
DialogBox("Edit a file", "edit.wbd")
If backup == 0 Then Goto nobackup
filebackupname = StrCat(FileRoot(file), ".",
"bak")
FileCopy(file, filebackupname, @TRUE)
:nobackup
If zoom == 1 Then Run("notepad.exe", file)
If zoom == 1 Then RunZoom("notepad.exe", file)
When you run it this time, the first box will
already be checked, because we first assigned a
value of 1 to the variable zoom. The variable
will still have a value of 1 after the
DialogBox statement is executed -- unless the
user un-checks the box, in which case it will
have a value of 0. The variable associated
with an unchecked box is always equal to 0; the
variable associated with a checked box is equal
to the value you specify for that box. For the
most part, you would be fine simply using a
value of 1 to indicate a checked box.
You can change the layout of the WBD template
to suit your taste. For example, this:
[zoom+1Start editor zoomed] [backup+1Save
backup of file]
would put the two check boxes side by side.
However, you may not put tab characters in a
template file, so be sure to use spaces instead
(unless your editor can convert tabs to
93
WIL Update Manual
spaces). Also, template files are limited to
20 lines, and to the first 60 columns
The next element which you can use in a dialog
box is the radio button. Whereas you can have
several check boxes checked at one time, the
radio button gets its name from the five-button
car radio, which can only have one station
selected at a time. You can have more than one
group of radio buttons, but only one button in
each group may be "pressed." Therefore, this
is ideal for situations where the user must
make a choice from multiple alternatives:
Here's a group of four radio buttons:
[editor^1Notepad] [editor^2WinEdit]
[editor^3Write] [editor^4WinWord]
Let's look at how these are different from
check boxes. First, the symbol which
identifies a radio button is a caret (^),
instead of a +. Second, each of the buttons
has the same variable name (editor). And
third, each button has a unique value following
the ^ symbol.
This should make sense if you consider what we
are trying to accomplish: we want to obtain a
value for the variable editor. The user has
four programs to choose from, and he must
choose one, and only one. As you have probably
guessed, the value associated with the button
which the user "pushes" will be assigned to
editor.
Let's add this to our existing EDIT.WBD
template:
[zoom+1Start editor zoomed]
[backup+1Save backup of file]
[editor^1Notepad] [editor^2WinEdit]
[editor^3Write] [editor^4WinWord]
94
WIL Update Manual
and expand our WIL program to take advantage of
it:
file = ItemSelect("", FileItemize("*.*"), " ")
zoom = 1
DialogBox("Edit a file", "edit.wbd")
If backup == 0 Then Goto nobackup
filebackupname = StrCat(FileRoot(file), ".",
"bak")
FileCopy(file, filebackupname, @TRUE)
:nobackup
If zoom == 0 Then runcmd = "Run"
If zoom == 1 Then runcmd = "RunZoom"
If editor == 1 Then %runcmd%("notepad.exe",
file)
If editor == 2 Then %runcmd%("winedit.exe",
file)
If editor == 3 Then %runcmd%("write.exe",
file)
If editor == 4 Then %runcmd%("winword.exe",
file)
(We're using the variable runcmd to avoid
having to code eight separate Run and RunZoom
statements. Pretty clever, isn't it.)
Look at how we are testing the value of editor
to determine which program to run. When the
DialogBox statement is executed, the first
radio button in each group is selected,
regardless of its value. In this case, the
first button appearing in the template, in the
editor group, has a value of 1, so, unless the
user selects a different button, the variable
editor will have a value of 1 after DialogBox
finishes, and Notepad will be run. If the user
selects the WinEdit button, editor will have a
value of 2 , and Winedit will be run.
Another important element which you can use in
your templates is the file selection list box,
which combines the functionality of DirItemize,
FileItemize, and ItemSelect. It has the
following form:
95
WIL Update Manual
[file\ ]
[file\ ]
[file\ ]
[file\ ]
[file\ ]
Here, file is the variable name (you can use
another name instead of file), and the
backslash (\) is the symbol which identifies
this as a file list element. The amount of
space between the \ symbol and the right
bracket will determine the width of the file
selection list box. And the number of
occurrences of this element (each must have an
identical name) will determine the height of
the list box.
Let's add this to our template:
[zoom+1Start editor zoomed]
[backup+1Save backup of file]
[editor^1Notepad] [editor^2WinEdit]
[editor^3Write] [editor^4WinWord]
[file\ ]
[file\ ]
[file\ ]
[file\ ]
[file\ ]
and revise our program:
96
WIL Update Manual
zoom = 1
DialogBox("Edit a file", "edit.wbd")
If backup == 0 Then Goto nobackup
filebackupname = StrCat(FileRoot(file), ".",
"bak")
FileCopy(file, filebackupname, @TRUE)
:nobackup
If zoom == 0 Then runcmd = "Run"
If zoom == 1 Then runcmd = "RunZoom"
If editor == 1 Then %runcmd%("notepad.exe",
file)
If editor == 2 Then %runcmd%("winedit.exe",
file)
If editor == 3 Then %runcmd%("write.exe",
file)
If editor == 4 Then %runcmd%("winword.exe",
file)
All we did was remove the first line from the
earlier example, which used FileItemize and
ItemSelect to retrieve a file name.
By default, the file selection list box uses
*.* as a file mask. If you want to limit the
selection to, say, DOC files, assign a value to
the appropriate variable before executing the
DialogBox statement:
file = "*.doc"
DialogBox("Edit a file", "edit.wbd")
Another element, the file mask edit box, allows
the user to change the file mask interactively.
It's format is:
[file# ]
Where the variable name, in this case file,
must be the same as the one used in the file
selection list box, and is followed by a number
sign (#). If the user enters a valid wild card
mask in the file mask edit box, the file
display in the file selection list box will be
updated accordingly. For example, if DOC files
97
WIL Update Manual
are currently shown, and the user types *.TXT,
the display will change to show TXT files.
You can optionally display the current
directory (whose contents are being listed) by
including an additional element in the
template:
[file$ ]
This is identical to the file list element,
except the symbol for the directory element is
a dollar sign ($). The variable name must be
the same as the one used in the file selection
list box:
[file$ ]
File mask [file# ]
[file\ ]
[file\ ]
[file\ ]
[file\ ]
[file\ ]
Note that we have included the descriptive text
"File mask" next to the file mask edit box.
You may place explanatory text anywhere in the
template file, as long as it doesn't appear
inside square brackets.
You can also display a WIL variable in your
dialog box by using an element of this form:
[varname$]
Where the name of the variable is followed by a
dollar sign ($). The WIL Interpreter will
replace this with the current value of the
variable.
Finally, we have the edit box, which allows us
to assign user-supplied text to a variable.
The edit box element has the form:
98
WIL Update Manual
[input# ]
The variable name (in this case, input) is
followed a number sign (#), and the width of
the area between the brackets determines the
width of the edit box which gets displayed.
Whatever the user types in the box gets
assigned to the associated variable. Here is a
sample RENAME.WBD template:
Select file to be renamed
[oldname$ ]
[oldname\ ]
[oldname\ ]
[oldname\ ]
[oldname\ ]
Type new name for the file
[newname# ]
Which could be used with this program:
DialogBox("File Rename", "rename.wbd")
FileRename(oldname, newname)
You will have noticed that there are two
symbols -- $ and # -- which have dual meanings,
depending on whether or not there is a file
list selection variable in the template with
the same name. The three file elements --
[file\], [file$], and [file#] -- are a "set",
and share a common variable name. All other
variables in your template should have unique
names.
99