This cardfile contains a quick summary of all the WinBatch functions -- and some other useful info
Wilson WindowWare
2701 California Ave SW #212
Seattle Wa, 98116
(206) 937-9335 FAX (206) 935-7129
----------------------------------------
----------------------------------------
Sample WBT file - SAMPLE.WBT
........................................
;This is a simple sample WBT file
;showing the batch language
a=AskYesNo("Hi Dere","Run Clock?")
if a==@YES then goto YES
Message("Hmmm","You hit No")
goto BYE
:YES
Display(5,"Hmmm","You hit yes")
Run("Clock.exe","")
:BYE
Exit
----------------------------------------
----------------------------------------
Sample WDF file - GLOBAL.WDF
........................................
The GLOBAL.WDF file defines global macros.
ClipBoard \ ^!C : clipboard.exe
Notepad \ ^!N : notepad.exe
My bat file \ ^S : winbatch.exe MY.WBT
----------------------------------------
----------------------------------------
Variables
........................................
Variable names start with a letter.
The rest of the name consists of letters and numbers, up to 30 characters total.
Variable names are NOT case sensitive, i.e. "Cat" and "cAT" are the same variable.
----------------------------------------
----------------------------------------
!
........................................
The logical NOT operator.
Produces @TRUE if the operand = zero, @FALSE if it's nonzero.
----------------------------------------
----------------------------------------
& | ^
........................................
The bitwise AND, OR, and XOR operators.
The operator will arithmetically AND, OR, or exclusive-OR two integers together.
a=5; = 101
b=4 = 100
c=a & b ; c=4 = 100
d=a | b ; d=5 = 101
e=a ^ b ; e=1 = 001
----------------------------------------
----------------------------------------
&& ||
........................................
The logical AND and OR operators.
These operators will logically AND or OR two numbers together.
a=0 ;0 means FALSE
b=4 ;nonzero means TRUE
c=a && b ; c is @FALSE ( 0 )
d=a || b ; d is @TRUE ( 1 )
See also & | and ^
----------------------------------------
----------------------------------------
( )
........................................
Parentheses.
Parentheses are used to control the order an expression is evaluated.
a = (4+5) * 2 ; a is 18
a = 4 + (5 * 2) ; a is 14
----------------------------------------
----------------------------------------
* / + - mod (binary)
........................................
Simple arithmetic operators.
* Multiplication
/ Division
+ Addition
- Subtraction
mod Modulo (divide, return remainder)
See also abs, min, max
----------------------------------------
----------------------------------------
~
........................................
Bitwise NOT operator.
Sets all 0 bits of the integer operand to 1, and vice-versa.
a=26 ;=00110100
b=~a ;=11001011, or -27
----------------------------------------
----------------------------------------
+ - (unary)
........................................
Unary arithmetic operators.
+ Identity
- Negation
----------------------------------------
----------------------------------------
<< >>
........................................
Bitwise shift operators.
<< Left Shift
>> Right Shift
c= 16 >> 2 ; c is 4
d= 16 << 2 ; c is 64
----------------------------------------
----------------------------------------
=
........................................
The assigment operator.
Assigns the value or string evaluated on the right side of the = sign to the variable on the left side.
----------------------------------------
----------------------------------------
== != <> <= >= > <
........................................
Relational operators.
== Equality
!= <> Inequality
<= Less than or equal to
>= Greater than or equal to
< Less than
> Greater than
These produce 0 (@FALSE) or 1 (@TRUE).
See also StrCmp, StrICmp
----------------------------------------
----------------------------------------
Abs (number)
........................................
Returns the absolute (positive) value of an integer number.
Fred=Abs(-4) ;Fred becomes 4
----------------------------------------
----------------------------------------
AskLine (title, prompt, default)
........................................
Gets a line of info from the user.
title = title of the dialog box.
prompt = question shown above edit box.
default= default entry in edit box.
Returns string the user enters into the edit box.
----------------------------------------
----------------------------------------
AskYesNo (title, prompt)
........................................
Asks the user a yes or no question.
title = title of the dialog box.
prompt = string shown above edit box.
Returns @YES or @NO depending on which button they press.
----------------------------------------
----------------------------------------
Average (num [,num]...)
........................................
Finds the average of a list of integers.
Returns average of the numbers, to the closest integer.
----------------------------------------
----------------------------------------
Beep
........................................
Sounds a short beep at the user.
Beep
Message("Be Alert","We need more lerts")
----------------------------------------
----------------------------------------
Call ("file.wbt","p1 p2 p3... pn")
........................................
Calls another WBT file as a subroutine. Can pass arguments. All variables are common (global) between the calling and the callee WBT file.
Call("chk-nam.wbt","Susie Creamcheese")
----------------------------------------
----------------------------------------
CallExt("file.wbt","p1 p2 p3 ... pn")
........................................
Calls another WBT file as a seperate subprogram. Can pass parameters to the file. No return value possible. All variables are different.
CallExt("Chk-Num.WBT","987 234 929")
----------------------------------------
----------------------------------------
Char2Num (string)
........................................
Converts the first character of a string to its ANSI code.
a=Char2Num("Z")
Message("Z's ANSI Code is",a)
----------------------------------------
----------------------------------------
ClipAppend (string)
........................................
Appends a string to the clipboard.
Clipboard must contain text, or be empty.
a="First"
b="Second"
ClipPut(a)
;clipboard = "First"
ClipAppend(b)
;clipboard = "FirstSecond"
----------------------------------------
----------------------------------------
ClipGet ()
........................................
Retrieves the contents of the Clipboard into a string variable.
Clipboard must contain only text.
a=ClipGet()
Message("Clipboard",a)
----------------------------------------
----------------------------------------
ClipPut (string)
........................................
Clears the clipboard and inserts a "string" into it. Clipboard will be marked as containing text.
a="First"
b="Second"
ClipPut(a)
;clipboard = "First"
ClipAppend(b)
;clipboard = "FirstSecond"
----------------------------------------
----------------------------------------
DateTime ()
........................................
Returns the current system date and time using the format declared in the International section of the WIN.INI file.
Message("Date and Time is",DateTime())
----------------------------------------
----------------------------------------
Debug (@ON | @OFF)
........................................
Turns the statement debugging dialog box on or off.
----------------------------------------
----------------------------------------
Delay (seconds)
........................................
Delays "seconds" seconds. While the delay is in progress other windows will receive processing time.
message("TEST","See you later")
delay(10)
message("TEST","I'm BAAAAAACK!")
----------------------------------------
----------------------------------------
DirChange ([d:] path)
........................................
Changes the current directory.
If the pathname includes a different drive than the current one, it will log onto the new drive.
DirChange ("d:\winword")
DirChange ("mysubdir")
----------------------------------------
----------------------------------------
DirGet ()
........................................
Returns the current directory.
----------------------------------------
----------------------------------------
DirHome ()
........................................
Returns the path to the WinBatch executable files.
----------------------------------------
----------------------------------------
DirItemize (dir-spec)
........................................
Returns the list of directories matching a set of wildcards. Usually "*.*" is used.
The directory names are separated by spaces.
DirItemize("*.*") ;returns all dirs
----------------------------------------
----------------------------------------
DirMake ([d:] path)
........................................
Creates a new directory.
DirMake ("Child")
DirMake ("..\..\Uncle")
DirMake ("..\..\Uncle\Cousin")
----------------------------------------
----------------------------------------
DirRemove ([d:] path)
........................................
Deletes a directory.
DirRemove ("..\..\Uncle\Cousin")
----------------------------------------
----------------------------------------
DirRename ([d:] oldpath, [d:] newpath)
........................................
Renames a directory.
DirRename("C:\TEMP","C:\WORK")
----------------------------------------
----------------------------------------
DiskFree (drive-list)
........................................
Returns the total available free space of all drives in the list.
a=DiskFree("C D") ;get free space
a=a/1024 ;convert to "K"
Message ("Free space on C&D","%a%K")
----------------------------------------
----------------------------------------
Display (seconds, title, text)
........................................
Displays a message for the indicated number of seconds.
You can stop the display by clicking on the message box with the mouse or pressing a key.
Display(5,"!!!","Bye bye in 5 seconds")
----------------------------------------
----------------------------------------
DOSVersion (@MAJOR | @MINOR)
........................................
Returns the version numbers of the current version of DOS.
"level" = @MAJOR returns the integer part and @MINOR returns the decimal part (to the right of the decimal).
r=DOSVersion(@MAJOR)
v=DOSVersion(@MINOR)
Message("DOS Version","%r%.%v%")
----------------------------------------
----------------------------------------
Drop (var [,var]...)
........................................
Deletes variables from the varaible list, thus conserving memory.
This is a recommended practice for large variables.
----------------------------------------
----------------------------------------
EndSession ()
........................................
Ends the current Windows session.
Has the same effect as closing the Program Manager.
----------------------------------------
----------------------------------------
Environment (env-variable)
........................................
Returns the contents of a DOS environ- ment variable.
a=Environment("PATH")
Message("Your PATH is",a)
----------------------------------------
----------------------------------------
ErrorMode(@OFF | @NOTIFY | @CANCEL)
........................................
Controls the error handling mode. @CANCEL (the default): Cancels the menu item at any error.
@NOTIFY: Informs the user and allows her to continue if the error is recoverable.
@OFF: Same as @NOTIFY, but suppresses any recoverable errors.
ERRORMODE(@OFF)
----------------------------------------
----------------------------------------
Exclusive (@ON | @OFF)
........................................
Controls whether or not other Windows program will get any time to execute. Exclusive(@ON) run the fastest but does not allow other Windows apps to get much time. Exclusive(@OFF) runs just a tad slower, is the default, and is nicely mannered to other applications.
----------------------------------------
----------------------------------------
Execute statement
........................................
Executes a statement in an "error protected" environment. Any error will be recoverable. Often used to interactively execute user-typed statements.
A=AskLine("DO","Enter Stmt","")
Execute %A%
----------------------------------------
----------------------------------------
Exit
........................................
Used to end processing in a WBT file
Exit is assumed at the end of all WBT files.
b=0
Exit
----------------------------------------
----------------------------------------
FileAppend (from-list, to-name)
........................................
Appends one or more filenames to the destination "to-name". Wildcards may be used in the from-list. The to-name may not be wildcarded.
FilAppend( "*.txt", "all.txt")
FileAppend( "a.txt b.txt", "ab.txt")
----------------------------------------
----------------------------------------
FileClose (filehandle)
........................................
Closes a file.
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)
----------------------------------------
----------------------------------------
FileCopy (from-list, to-name, warn)
........................................
Copies one or more filenames to the destination "to-name". Wildcards may be used. If more than one file is copied, to-name should be a wildcard.
If "warn" is @TRUE, the user will get a warning before overwriting a file.
FileCopy("C:\win\*.*", "A:", @TRUE)
----------------------------------------
----------------------------------------
FileDelete (file-list)
........................................
Deletes one or more files. More than one filename may be specified. Wildcards may be used.
FileDelete("*.BAK *.OLD")
----------------------------------------
----------------------------------------
FileExist (filename)
........................................
Determines whether or not a file exists.
Returns @TRUE or @FALSE.
Unless it is a full pathname, The current directory will be checked, and then all directories on the DOS PATH will be checked.
a=FileExist ("WIN.INI")
a=FileExist ("c:\windows\win.ini")
----------------------------------------
----------------------------------------
FileExtension (filename)
........................................
FileExtension parses the passed filename and returns the extension part of the filename.
----------------------------------------
----------------------------------------
FileItemize (file-list)
........................................
Returns the list of files matching the set of wildcards specified.
The filenames are separated by spaces.
FileItemize("*.BAK") ;returns all BAK's
FileItemize("*.ARC *.ZIP *.LZH")
;returns list of compressed files
----------------------------------------
----------------------------------------
FileLocate (filename)
........................................
Attempts to find "filename" in the current directory, and along the DOS PATH. If found, the function will return the complete pathname to the file.
a=FileLocate("WIN.INI")
Message("WIN.INI is located in",a)
----------------------------------------
----------------------------------------
FileMove (from-list, to-name, warn)
........................................
Moves one or more filenames to the destination "to-name". Wildcards may be used. If more than one file is moved, "to-name" should be a wildcard.
If the destination is on the same drive, a rename will occur instead of a move.
If "warn" = @TRUE the user gets a warning before overwriting a file.
FileMove("C:\win\*.*","A:",@TRUE)
----------------------------------------
----------------------------------------
FileOpen ( filename, open-type)
........................................
FileOpen opens a STANDARD ASCII (only) file for reading or writing. It returns a FILEHANDLE to be used to read,
write and close the file.
To open for reading:
FileOpen("stuff.txt","READ")
To open for writing:
FileOpen("stuff.txt","WRITE")
----------------------------------------
----------------------------------------
FilePath (filename)
........................................
FilePath parses the passed filename and returns the drive and path of the file specification, if any.
----------------------------------------
----------------------------------------
FileRead(filehandle)
........................................
FileRead reads data from a file. At EOF the string *EOF* will be returned.
Handle=FileOpen("autoexec.bat","READ")
:top
Line=FileRead(Handle)
Display(4,"AUTOEXEC DATA",Line)
if Line!="*EOF*" then goto top
FileClose(Handle)
----------------------------------------
----------------------------------------
FileRename (file-list, to-name)
........................................
Renames one or more filenames to the destination "to-name". Wildcards may be used. If more than one file is renamed, "to-name" should be a wildcard.
The destination MUST be on the same drive as the source. You may wish to use FileMove instead of FileRename.
FileMove("C:\win\*.*","A:")
----------------------------------------
----------------------------------------
FileRoot (filename)
........................................
FileRoot parses the passed filename and returns the root part of the filename.
----------------------------------------
----------------------------------------
FileSize (file-list)
........................................
Adds the sizes of all the files in the list and returns the total.
a=FileSize(FileItemize("*.*"))
Message("Size of all files in dir",a)
----------------------------------------
----------------------------------------
FileWrite(filehandle,output-data)
........................................
FileWrite writes data to a file.
Handle=FileOpen("Stuff.txt","WRITE")
FileWrite(Handle,"Gobbledygook")
FileClose(Handle)
----------------------------------------
----------------------------------------
Goto :LABEL
........................................
Goto tranfers control to the indicated label. The label must begin with a colon (just like DOS BAT files).
Goto's are especially handy when used with the IF-THEN statements. As in...
IF a==5 then GOTO ZORK
----------------------------------------
----------------------------------------
IF - THEN
........................................
IF condition THEN statement
Example
IF a==5 then GOTO ZORK
...
:ZORK
Message("HI","WE AT ZORK")
----------------------------------------
----------------------------------------
IgnoreInput(@TRUE | @FALSE)
........................................
IgnoreInput turns off hardware input to windows. Causes mouse movements, clicks and keyboard entry to be completely ignored. Good for self-running demos.
IgnoreInput(@TRUE)
If you are not careful with the use of IgnoreInput, you can hang your machine.
----------------------------------------
----------------------------------------
IniRead (section, keyword, default)
........................................
Looks up a value in the WIN.INI file. If the value is not found, the "default" will be returned.
IniRead ("windows","device","none")
will look in
[windows]
device=...
and return the default ptr or "none".
----------------------------------------
----------------------------------------
IniReadPvt (sec, key, default,filename)
........................................
Looks up a value in the "filename" ini file. If the value is not found, the "default" will be returned.
IniReadPvt
("Main","Lang","English","WB.INI")
WB.INI
[Main]
Lang=German
----------------------------------------
----------------------------------------
IniWrite (section, keyword, data)
........................................
Modifies the WIN.INI file with the desired data.
IniWrite("WinBatch","MyVar",5)
will create a new keyword entry in the WinBatch section:
[WinBatch]
MyVar=5
----------------------------------------
----------------------------------------
IniWritePvt (sec, key, data,filename)
........................................
Writes a value in the "filename" ini file.
IniWritePvt
("Main","Lang","French,"WB.INI")
Makes...
WB.INI
[Main]
Lang=French
----------------------------------------
----------------------------------------
IsDefined (variable)
........................................
Determines whether or not a variable has been defined.
Returns @YES or @NO.
----------------------------------------
----------------------------------------
IsKeyDown(key-codes)
........................................
Determines if the SHIFT key or the CTRL key is currently down.
IsKeyDown(@SHIFT)
IsKeyDown(@CTRL)
IsKeyDown(@CTRL|@SHIFT)
IsKeyDown(@CTRL&@SHIFT)
Returns TRUE or FALSE.
Note: Right Mouse button same as SHIFT
Middle button same as CTRL
----------------------------------------
----------------------------------------
IsLicensed()
........................................
Returns whether or not the current version of WinBatch is a licensed copy or not.
----------------------------------------
----------------------------------------
IsNumber (string)
........................................
Determines if a string can be converted into a number.
Returns @YES or @NO.
n=AskLine("TEST","Enter a number",entry)
Terminate(!IsNumber(entry),"Must Enter a
Number")
----------------------------------------
----------------------------------------
ItemCount (list,delimiter)
........................................
Returns the number of items in a list. The items in the list must be separated by the "delimiter" character - usually " " for dirs and files, and a tab for window titles.
a=FileItemize("*.*")
n=ItemCount(a," ")
Message("Note","There are %n% files")
----------------------------------------
----------------------------------------
ItemExtract (select, list, delimiter)
........................................
Returns the selected item from a list. The items in the list must be separated by the "delimiter" character - usually " " for dirs and files, and a tab for window titles.
a="My dog has fleas"
w=ItemExtract(2,a," ")
Message("The second word is",w)
----------------------------------------
----------------------------------------
ItemSelect (title, list, delimiter)
........................................
Returns a single item chosen from a list box presented to the user. The items in the list must be separated by the "delimiter" character - usually " " for dirs and files, and a tab for window titles.
a=FileItemize("*.DOC")
a=ItemSelect("Files",a," ")
b=WinItemize()
b=ItemSelect("Windows",b,char2num(9))
----------------------------------------
----------------------------------------
LastError ()
........................................
Returns a numeric value representing the last error that occurred. Each error has a different value. 0 means no error occurred.
To use use LastError, ErrorMode() must be set to @NOTIFY or @OFF to avoid the default @CANCEL on error recovery.
----------------------------------------
----------------------------------------
LogDisk (diskdrive)
........................................
Selects the first character of the "diskdrive" string and logs that disk as the current disk.
DirChange will log a new drive if the pathname you want to change to is on a different one than the current one.
LogDisk("D")
----------------------------------------
----------------------------------------
Max (num [,num]...)
........................................
Examines a series of integers and returns the largest number in the list.
a=max(100, -50, 30, 200, 10)
message("answer will be 200",a)
----------------------------------------
----------------------------------------
Message (title, text)
........................................
Displays a message box to the user, with a specified "title" and "text".
There will be an OK button for the user to press.
Message("Hello","This is an example.")
----------------------------------------
----------------------------------------
Min (num [,num]...)
........................................
Examines a series of integers and returns the smallest number in the list.
a=min(100, -50, 30, 200, 10)
message("answer will be -50", a)
----------------------------------------
----------------------------------------
Num2Char (number)
........................................
Converts a number to a one-character string. Use this to display special ANSI characters.
tab=num2char(9)
c=num2char(169) ;(c) symbol
Message("Command Post", "%c%1990")
----------------------------------------
----------------------------------------
ParseData(string)
........................................
Parses the passed string just like passed parameters are parsed. variables show up as param1, param2, etc. param0 is the count of the number of parameters.
a="1 2 Susie Q"
ParseData(a)
>>>And the results are...
param0=4 param1=1 param2=2
param3="Susie" Param4="Q"
----------------------------------------
----------------------------------------
Pause (title, text)
........................................
Presents the user with a message box, using the "title" and "text" supplied.
The box has two buttons - OK and CANCEL.
If OK is selected, processing continues.
If CANCEL is selected, processing terminates.
Pause("Hey You","Insert Floppy in A:")
FileCopy("C:\DOC\*.DOC","A:")
----------------------------------------
----------------------------------------
Random (max)
........................................
Returns a psuedo-random integer between 0 and "max".
A=Random(10) ; between 0 and 10
B=Random(20) ; between 0 and 20
c=Random(10)+10 ; between 10 and 20
----------------------------------------
----------------------------------------
Return
........................................
Used to return from a Call or a CallExt to the calling program.
If the program was not called, then an EXIT is assumed.
----------------------------------------
----------------------------------------
Run (program, parameters)
........................................
Runs a "program" with the specified "parameters".
The program's window is passed a request to show itself as a default window size & position.
Run("notepad.exe","win.ini")
run("Clock.exe","") ; note empty parms
----------------------------------------
----------------------------------------
RunHide (program, parameters)
........................................
Runs a "program" with the specified "parameters".
The program's window is passed a request to hide itself.
RunHide("notepad.exe","win.ini")
runHide("Clock.exe","") ; no parms
----------------------------------------
----------------------------------------
RunIcon (program, parameters)
........................................
Runs a "program" with the specified "parameters".
The program's window is passed a request to show itself as an icon ('minimized' window).
RunIcon("notepad.exe","win.ini")
runIcon("Clock.exe","") ; no parms
----------------------------------------
----------------------------------------
RunZoom (program, parameters)
........................................
Runs a "program" with the specified "parameters".
The program's window is passed a request to show itself as a full-screen ('maximized') window.
RunZoom("notepad.exe","win.ini")
runZoom("sol.exe","") ; no parms
----------------------------------------
----------------------------------------
SendKey(character-codes)
........................................
Sends Keystrokes to the active application. Much like the Excel SendKey Statement.
Start Notepad. Use *.* for filenames.
Run("Notepad.exe","")
SendKey("!FO*.*~")
See EXCEL Sendkey docs 'cept WinBatch uses ! instead of % for Alt-Keys.
----------------------------------------
----------------------------------------
SKDebug(@OFF | @ON | @PARSEONLY)
........................................
Controls how SendKey works
@OFF - Debug Off - Normal, default operation
@PARSEONLY Debug On Keystrokes not sent to app. File C:\SKDEBUG.TXT contains parsed keystrokes
@ON Debug ON. Keystrokes Sent. File Written
----------------------------------------
----------------------------------------
StrCat (string [,string]...)
........................................
Concatenates any number of strings together and returns the concatenated string.
crlf=strcat(num2char(13),num2char(10))
a=strcat("line1",crlf,"line2")
;a="line1
line2"
----------------------------------------
----------------------------------------
StrCmp (string1, string2)
........................................
Compares two strings and return one of three possible values:
if "string1" is before "string2" -1
if "string1" equals "string2" 0
if "string1" is after "string2" 1
----------------------------------------
----------------------------------------
StrFill (source, length)
........................................
Creates a string by concatenating multiple copies of the "source" string to itself until the string length equals "length".
aa=Strfill("*",20)
message("20 Stars",aa)
----------------------------------------
----------------------------------------
StrFix (base, pad, length)
........................................
If the "base" string is longer than "length" it will be truncated, else if it's shorter than "length" it will be padded with the "pad" string until it is "length" in size.
----------------------------------------
----------------------------------------
StrICmp (string1, string2)
........................................
Compares two strings and returns one of three possible values, IGNORING CASE:
if "string1" is before "string2" -1
if "string1" equals "string2" 0
if "string1" is after "string2" 1
----------------------------------------
----------------------------------------
StrIndex (string, substring, start, dir)
........................................
Searches the "string", looking for the first occurrance of the "substring" after the "start" position. "dir" may be either @FWDSCAN or @BACKSCAN to control the direction of the search.
example: to parse filename:
a=CurrentFile()
i=strindex(a,".",1,@FWDSCAN)
root=strsub(a,1,i-1)
ext =strsub(a,i+1,strlen(a)-i)
----------------------------------------
----------------------------------------
StrLen (string)
........................................
Returns the length of a "string".
a="ABCDE"
Message("Length of ABCDE is",strlen(a))
----------------------------------------
----------------------------------------
StrLower (string)
........................................
Returns the lowercase version of a "string".
a=AskLine("Please","Enter Name","")
a=strlower(a)
b=strsub(a,1,1)
b=strupper(b)
c=strsub(a,2,strlen(a)-1)
a=strcat(b,c)
Message("Thanx",a)
----------------------------------------
----------------------------------------
StrReplace(string,old,new)
........................................
StrReplace scans the 'string', searching for occurrances of 'old' and replacing each occurrance with 'new'.
e.g. Copy highlited files to clipboard:
a=FileItemize("")
crlf=StrCat(Num2Char(13),Num2Char(10))
StrReplace(a," ",crlf)
ClipPut(a)
----------------------------------------
----------------------------------------
StrScan (main, delims, start, dir)
........................................
Scans a "string" for the first occurrance of ANY character in the "delims" string. The scanning starts at "start" position and goes in the "dir" direction, which may be either @FWDSCAN
or @BACKSCAN.
----------------------------------------
----------------------------------------
StrSub (string, start, length)
........................................
Returns the substring of "string" which starts in position "start" and goes for "length" characters.
----------------------------------------
----------------------------------------
StrTrim (string)
........................................
Removes all leading and training spaces, if any, from "string" and returns the trimmed string.
----------------------------------------
----------------------------------------
StrUpper (string)
........................................
Returns the uppercase version of a "string".
a=AskLine("Please","Enter Name","")
a=strlower(a)
b=strsub(a,1,1)
b=strupper(b)
c=strsub(a,2,strlen(a)-1)
a=strcat(b,c)
Message("Thanx",a)
----------------------------------------
----------------------------------------
TextBox (title, filename)
........................................
Displays a file in a listbox with a "title". It may be used for multiline messages or instructions.
If the user highlights a line, it will be returned as a text string, thus TextBox can also be used as a selection box.
TextBox("CONFIG.SYS","C:\CONFIG.SYS")
----------------------------------------
----------------------------------------
Version ()
........................................
Returns the version of the current WinBatch program.
a=Version()
Message("WinBatch","Version %a%")
----------------------------------------
----------------------------------------
WallPaper (bmp-name, tile)
........................................
WallPaper immediately changes the Windows wallpaper. Can even be used for slide shows.
a=FileItemize("*.BMP")
a=ItemSelect("Select New paper",a," ")
tile=@FALSE
if FileSize(a)<40000 then tile=@TRUE
Wallpaper(a,tile)
----------------------------------------
----------------------------------------
WinActivate (partialwindowname)
........................................
Activates the named window. Only the first part of the "partialwindowname" is required.
a=WinItemize()
a=ItemSelect("Choose a Window",a)
WinActivate(a)
----------------------------------------
----------------------------------------
WinArrange (style)
........................................
Tiles, stacks, arranges in rows or arranges in columns the various open windows on the screen.
"style" may be @ROWS or @COLUMNS
or @STACK or @ARRANGE
WinArrange("Stack")
----------------------------------------
----------------------------------------
WinClose (partialwindowname)
........................................
Closes the first window found in which the first part of the windows name matches "partialwindowname".
WinClose("Clock")
WinClose("Clo")
----------------------------------------
----------------------------------------
WinCloseNot (pwn [,pwn]...)
........................................
Closes all the windows EXCEPT the ones that match the "partialwindowname"s in the parameter list.
WinCloseNot("MS-DOS","Clock","PageMa")
----------------------------------------
----------------------------------------
WinConfig ()
........................................
Returns the Windows configuration information as a number. Bits are defined as follows:
1 Protect Mode | 64 8086 CPU
2 80286 CPU | 128 80186 CPU
4 80386 CPU | 256 Large PageFrame
8 80486 CPU | 512 Small PageFrame
16 Standard Mode |1024 80x87 Installed
32 Enhanced Mode |
----------------------------------------
----------------------------------------
WinExist (partialwindowname)
........................................
Returns @TRUE or @FALSE, depending on whether a matching window can be found.
a=WinExist("Clock")
----------------------------------------
----------------------------------------
WinGetActive ()
........................................
Returns the complete title of the currently active window.
Unless a WinActivate or other command was used, WinGetActive will generally return the current Command Post's window title.
a=WinGetActive()
Message("Active window was",a)
----------------------------------------
----------------------------------------
WinHide (partialwindowname)
........................................
Hides the first window in which the first part of the window name matches "partialwindowname". The window still exists, but is not available to the user until a WinShow command is executed.
run("clock.exe","")
WinHide("Clock")
----------------------------------------
----------------------------------------
WinIconize (partialwindowname)
........................................
Iconizes ('minimizes') the first window in which the first part of the window name matches "partialwindowname".
Run("Clock.exe","")
WinIconize("Clock")
;equivalent to
RunIcon("Clock.exe","")
----------------------------------------
----------------------------------------
WinItemize ()
........................................
Returns a list of all the currently- running windows, by window title, separated by tabs within the string.
;Closes selected window
a=WinItemize()
a=ItemSelect("CLOSE",a)
WinCLose(a)
----------------------------------------
----------------------------------------
WinPlace (x-ul, y-ul, x-br, y-br, pwn)
........................................
Places and sizes a window anywhere on the screen. Use the WININFO.EXE utility to help write the WinPlace statements.
x-ul x co-ordinate upper left
y-ul y co-ordinate upper left
x-br x co-ordinate bottom right
y-br y co-ordinate bottom right
pwn partial window name
WinPlace(10,10,300,300,"Clock")
----------------------------------------
----------------------------------------
WinPosition (partialwindowname)
........................................
Returns the current Window position information for the selected Window. It returns 4 comma separated numbers.
a=WinPosition("Clock")
A return value for the above function might be "0,0,100,100".
----------------------------------------
----------------------------------------
WinShow (partialwindowname)
........................................
Shows the first window in which the first part of the window name matches "partialwindowname".
runhide("clock.exe","")
WinShow("Clock")
----------------------------------------
----------------------------------------
WinTitle (pwn, new-name)
........................................
Changes the title of the first window in which the first part of the window name matches "pwn". That window will be named "new-name".
Note: Some applications do not take kindly to having their window's title changed.
WinTitle( "Clock", "Chronometer")
----------------------------------------
----------------------------------------
WinVersion (@MAJOR | @MINOR)
........................................
Returns the version numbers of the current version of Windows.
"level" = @MAJOR returns the integer part and @MINOR returns the decimal part (to the right of the decimal).
r=WinVersion(@MAJOR)
v=WinVersion(@MINOR)
Message("Windows Version","%r%.%v%")
----------------------------------------
----------------------------------------
WinWaitClose (partialwindowname)
........................................
Suspends execution until there are no windows in which the first part of the window title matches "partialwindowname".
run("notepad.exe","special.txt")
Message("Edit file","Close when done")
WinWaitClose("Notepad")
Message("Edit file","You may continue")
----------------------------------------
----------------------------------------
WinZoom (partialwindowname)
........................................
Zooms ('maximizes') the first window in which the first part of the window name matches "partialwindowname".
Run("clock.exe","")
WinZoom("Clock")
;equivalent to
RunZoom("clock.exe","")
----------------------------------------
----------------------------------------
Yield
........................................
Suspends menu execution for enough time for other windows to process a few messages.