---------------------------------------- @ Command Post Language Summary @ ........................................ Copyright 1988-1991, Morrie Wilson All rights reserved. This cardfile contains a quick summary of all the Command Post Menu Language functions -- and some other useful info Wilson WindowWare 2701 California Ave SW #212 Seattle Wa, 98116 (206) 937-9335 FAX (206) 935-7129 ---------------------------------------- ---------------------------------------- @@ Added Functions -- IF --THEN ........................................ Command Post now has IF-THEN statements. As in IF condition THEN statement Example: IF a>5 then Message("Hello","A GT 5") ---------------------------------------- ---------------------------------------- @@ Added Functions -- GOTO ........................................ Command Post now has GOTO statements ...and labels. As follows: Note labels begin with : A=0 :LOOP IF A>5 then goto NEXT Message("A is now",A) A=A+1 goto LOOP :NEXT Message("DONE","Loop Exited") ---------------------------------------- ---------------------------------------- @@ Added Functions -- HOTKEYS ........................................ Hotkeys can how be added to any menu item. Hotkeys are keys which immediately activate a menu item. Most any keystroke combination except ALT-char (which is used by Windows) may be put on a menu item. See the section on Menu Structure. ---------------------------------------- ---------------------------------------- @@ Added Functions -- WALLPAPER ........................................ Added a new function that allows immediate change of the Windows Wallpaper. WallPaper(BMPFILE,TILE) examples Wallpaper("weave.bmp",@TRUE) WallPaper("Bambi.bmp",@FALSE) ---------------------------------------- ---------------------------------------- @@ Added Functions -- DirRename ........................................ A DirRename function, inexplicably missing from the original versions, has been added. ---------------------------------------- ---------------------------------------- @@ Added Functions -- File Hiliting ........................................ The following functions are not in the 7.0 manual: FileHilite ...Hilites/unhilites files ---------------------------------------- ---------------------------------------- @@ Added Functions -- File IO ........................................ FileOpen, FileRead, FileWrite, and FileClose functions have been added to Command Post. See examples in main reference section... ---------------------------------------- ---------------------------------------- @@ Added Functions -- FileAppend ........................................ A FileAppend function has been added, which allows you to append data to the end of files. Kind of getting the DOS COPY a.xxx+b.xxx+c.xxx all.xxx ability into CmdPost ---------------------------------------- ---------------------------------------- @@ Added Functions -- Info retrival ........................................ The following functions are not in the 7.0 manual: IsLicensed ...Tells if CP licensed IsKeyDown ...Tells about keys/mouse DOSVersion ...Returns DOS/OS2 version WinConfig ...Returns WIN3 mode flags WinPosition ...Returns Window position WinExist ...Tells is Window exists ---------------------------------------- ---------------------------------------- @@ Added Functions -- Items and Lists ........................................ In addition to the already existing FileItemize, DirItemize, WinItemize and the ItemSelect function, two new functions have been added for "list" processing. They are: ItemCount(list,delim) and ItemExtract(number,list,delim) ---------------------------------------- ---------------------------------------- @@ Added Functions -- Private INIs ........................................ Two new functions for reading and writing private ini files. They are IniReadPvt and IniWritePvt ---------------------------------------- ---------------------------------------- @@ Added Functions -- Filename Parsing ........................................ The following functions are not in the 7.0 manual: FileRoot ...returns root of file FileExtension ...returns ext of file FilePath ...returns path of file ---------------------------------------- ---------------------------------------- @@ Added Functions -- Network Support ........................................ The following functions are not in the 7.0 manual: DiskReset ...re-examines available disks DiskHide ...Hides disks from display ---------------------------------------- ---------------------------------------- @@ Added Functions -- String Handling ........................................ The following functions are not in the 7.0 manual: StrReplace ...Replaces all occurances of a substring with another ---------------------------------------- ---------------------------------------- @@ Mouse - A Quickie Overview ........................................ The following few cards discuss some of the mouse control of the CmdPost window. Some shorthand notation used is: LC - Left Click RC - Right Click LDBL - Left Double Click RDBL - Right Double Click ---------------------------------------- ---------------------------------------- @@ Mouse - Disk switching ........................................ LC the desired drive to switch the Command Post window to that drive. Keyboard equivalent is CTRL-(whatever driveletter you need) ---------------------------------------- ---------------------------------------- @@ Mouse - Navigating the Tree - DOWN ........................................ Subdirectories are shown in BOLD type at the top of the file listing. LC to select a subdir - clears all other selections RC to select a subdir - keeps other selections LDBL switch to selected subdir ---------------------------------------- ---------------------------------------- @@ Mouse - Navigating the Tree - UP ........................................ At the top of the file window, next to the disk drive icons is the current pathname. LC on the desired directory in the pathname to see that directory Keyboard equivalent is using the BACKSPACE key to move up one level at a time. ---------------------------------------- ---------------------------------------- @@ Mouse - On a file name ........................................ LC selects a file - clears all other selections RC selects a file - keeps other selections. Can DRAG the mouse. LDBL runs selected file. If not an EXE, COM, BAT, or PIF file, the [extensions] of WIN.INI is used. RDBL will select/unselect all files with the same extension. ---------------------------------------- ---------------------------------------- @@ Mouse - Quickie Menu Items ........................................ Several items in the CMDPOST.CPM menus have been programmed to bypass the "confirm" box ->IF THE RIGHT MOUSE BUTTON IS HELD DOWN WHILE THE MENUITEM IS SELECTED AS USUAL WITH THE LEFT BUTTON<- Some of these menuitems are: File.Browse File.Copy File.NotepadEdit File.Move File.Copy File.Move/Rename ---------------------------------------- ---------------------------------------- @@ WIN.INI Variables ........................................ Documentation on WIN.INI settings may be found in the #WININI.TXT file in the scratch directory used during installation (usually C:\CP-NOTES.TMP\) The only item intended for user modification is AutoUpdate. If you set it to zero, you will disable the automatic updating the CmdPost directory window undergoes. e.g. [CmdPost] AutoUpdate=0 ---------------------------------------- ---------------------------------------- Menu Structure #1 -- Intro ........................................ Command Post is controlled by CPM (Command Post Menu) files. The Command Post menu files control the menus of the Command Post window and what happens when one of the menu items is selected. The CPM files are used to define the main menu items, the drop down menu items and the statements that are executed when a drop down item is selected. ---------------------------------------- ---------------------------------------- Menu Structure #2 -- Statements ........................................ There are three type of statements in a CPM file. They are: 1) Main Menu Title Lines (Col. 1) 2) Dropdown Menu Title Lines (Col. 2) 3) Executable Statement lines (Col. 8) The column a line starts in is used to determine what kind of line it is. Main menu lines start in column 1, dropdown in column2 and statements in 8. ---------------------------------------- ---------------------------------------- Menu Structure #3 -- Structure ........................................ Main Menu Name A DropDown Menu Name A-1 DropDown menu Name A-2 Main Menu Name B DropDown menu name B-1 ; Comment. ; Next line declares a 2nd .cpm file: #NextFile SECOND.CPM ---------------------------------------- ---------------------------------------- Menu Structure #4 -- Sample ........................................ Stuff Start Clock Run("CLOCK.EXE","") Get Phonebook DirChange("C:\NOTES") Run("CARDFILE.EXE","PHONES.CRD") Games Solitaire Run("SOL.EXE","") Reversi Run("REVERSI.EXE","") ---------------------------------------- ---------------------------------------- Menu Structure #5 -- HotKeys ........................................ HotKeys may be assigned to drop down menu items. HotKeys are single keystrokes that cause a menu item to be executed. Almost any key on the keyboard may be used as a hotkey, with the exception of ALT and ALT-SHIFT keys which are used by Windows (You can use ALT-CTRL keys. ---------------------------------------- ---------------------------------------- Menu Structure #6 -- HotKeys ........................................ Hoykeys are attached to menu items by defining them in the CPM file. The hotkey definition is placed after a dropdown menu title. E.G. Stuff Run Clock \ {F1} | |--Use the F1 Key |------Required Backslash The backslash is used to separate the dropdown title from the hotkey. ---------------------------------------- ---------------------------------------- Menu Structure #7 -- HotKeys ........................................ Hoykeys can be almost any key on the keyboard. A-Z, F1-F16 and others. Combinations of CTRL, SHIFT and ALT also work. A hotkey definition consists of a prefix (if any) and the hotkey itself. First a few samples... ^Z - CTRL-Z A - The letter A ^{F1} - CTRL-F1 +A - SHIFT-A {DELETE} - DELETE ^A - CTRL-A {INSERT} - INSERT ^!A - CTRL-ALT-A ---------------------------------------- ---------------------------------------- Menu Structure #8 -- HotKeys ........................................ Prefixes tell Command Post if the SHIFT, CTRL, and/or ALT key should be down for the key to take effect. Prefixes are NOT required. Valid prefixes are: ^ -- CTRL ^+ -- CTRL-SHIFT ^! -- CTRL-ALT ^+!-- CTRL-SHIFT-ALT + -- SHIFT Note: ALT and SHIFT-ALT alone is not OK ---------------------------------------- ---------------------------------------- Menu Structure #9 -- HotKeys ........................................ You may use the keys A thru Z, 1 thru 9, assorted punctuation, and the other keys, which are defined with keycodes. The valid keycodes are: {F1} thru {F16} <<<< BUT NOT {F10} >>>> {DELETE} {INSERT} {SPACE} {ENTER} {BACKSPACE} {TAB} {ESC} {UP} {DOWN} {LEFT} {RIGHT} {HOME} {END} {PGUP} {PGDN} ---------------------------------------- ---------------------------------------- Menu Structure #9A -- Hotkeys ........................................ Note that you can override some of Command Post's built in capability with the keycodes. For Example, if you use ^C for a menu item, you lose the capability to select your C drive with the ^C keystroke. Also note that you cannot use {F10} as a hot key because Windows treats the F10 key just like another ALT key. ---------------------------------------- ---------------------------------------- Menu Structure #9B -- Sample ........................................ 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","") ---------------------------------------- ---------------------------------------- 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") ---------------------------------------- ---------------------------------------- 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" ---------------------------------------- ---------------------------------------- CurrentFile() ........................................ Returns the currently selected filename. The currently selected file name is the one with the dashed box around it. If could be a directory if that is what the dashed box is around. ---------------------------------------- ---------------------------------------- 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 Command Post executable files. ---------------------------------------- ---------------------------------------- DirItemize (dir-spec) ........................................ Returns either all the highlighted directories (if dir-spec = "") or the list of directories matching a set of wildcards. Usually "*.*" is used. The directory names are separated by spaces. DirItemize("") ;returns hilited dirs 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") ---------------------------------------- ---------------------------------------- DiskHide (Drive-Letter-List) ........................................ Instructs Command Post to suppress the disk drive icon display for all drives in the Drive-Letter-List. E.G. If you are on a network, and NEVER care what drives S,T,U,V and W have on them, you may issue the command: DiskHide("STUVW") ---------------------------------------- ---------------------------------------- DiskReset () ........................................ DiskReset causes Command Post to re-examine all attached drives. This command is used after attaching or detaching network drives to re-sync the display to the state of the network. ---------------------------------------- ---------------------------------------- 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 local variables. ---------------------------------------- ---------------------------------------- EndSession () ........................................ Ends the current Windows session. Has the same effect as choosing File/Exit in Win 2.x, or closing the Program Manager in Win 3.0 ---------------------------------------- ---------------------------------------- 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) ---------------------------------------- ---------------------------------------- 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 a menu item. Exit is assumed at the end of all menu items. 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. ---------------------------------------- ---------------------------------------- FileHilite (masks,flag) ........................................ Hilites or unhilites files masks - which files to affect flag - @TRUE - Hilite matching files @FALSE -Unhilite matching files FileHilite("*.ZIP *.LZH *.ARC",@TRUE) FileHilite("OLD*.ZIP",@FALSE) ---------------------------------------- ---------------------------------------- FileItemize (file-list) ........................................ Returns either a list of highlighted files (if file-list = "") or the list of files matching the set of wildcards specified. The filenames are separated by spaces. FileItemize("") ;returns hilited files 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). The label MUST be within the current menu item. See CMDPOST.CPM for bunches of examples. Goto's are especially handt when used with the IF-THEN statements. As in... IF a==5 then GOTO ZORK ---------------------------------------- ---------------------------------------- IF - THEN ........................................ IF - THEN statements (along with GOTO's) give true batch file capability to the Command Post language. IF condition THEN statement Example IF a==5 then GOTO ZORK See CMDPOST.CPM for lots of examples. ---------------------------------------- ---------------------------------------- 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","CMDPOST.INI") CMDPOST.INI [Main] Lang=German ---------------------------------------- ---------------------------------------- IniWrite (section, keyword, data) ........................................ Modifies the WIN.INI file with the desired data. IniWrite("CmdPost","MyVar",5) will create a new keyword entry in the CmdPost section: [CmdPost] MyVar=5 ---------------------------------------- ---------------------------------------- IniWritePvt (sec, key, data,filename) ........................................ Writes a value in the "filename" ini file. IniWritePvt ("Main","Lang","French,"CMDPOST.INI") Makes... CMDPOST.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 Command Post is a licensed copy or not. Mainly used to predict what CP's window titles are going to be. In the unlicensed versions, the titles are fixed. In licensed versions, they are programmable. ---------------------------------------- ---------------------------------------- IsMenuChecked (menuname) ........................................ Determines whether or not a menu item is currently checked. Returns @YES or @NO. ---------------------------------------- ---------------------------------------- IsMenuEnabled (menuname) ........................................ Determines whether or not a menu item is currently enabled (i.e. not grayed). Returns @YES or @NO. Terminate(!IsMenuEnabled,"ViewName","") ---------------------------------------- ---------------------------------------- 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") ---------------------------------------- ---------------------------------------- IsRunning () ........................................ Returns @TRUE if another copy of Command Post is already running. Returns @FALSE if this is the first instance of Command Post. ---------------------------------------- ---------------------------------------- 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) ---------------------------------------- ---------------------------------------- MenuChange (menuname, flags) ........................................ Changes a menu item to be checked or unchecked, enabled or disabled(grayed). The permissable flags are @CHECK or @UNCHECK @ENABLE or @DISABLE @CHECK or @UNCHECK may be or'ed with @ENABLE or @DISABLE using the | operator. ---------------------------------------- ---------------------------------------- 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") ---------------------------------------- ---------------------------------------- OtherDir () ........................................ Returns the drive and directory that the "other" (second-most recently used) Command Post window is set to. If there is no other Command Post window (or if this one was the first), then the disk and directory of the current window will be used. a=OtherDir() Message("The Other Directory is",a) ---------------------------------------- ---------------------------------------- OtherUpdate () ........................................ Causes the "other" (second-most recently used) Command Post window to update its display. This command is useful when the current Command Post window may have altered the directory or file structure so that an update is desirable. ---------------------------------------- ---------------------------------------- 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 ---------------------------------------- ---------------------------------------- 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 ---------------------------------------- ---------------------------------------- SetDisplay (detail, sort, masks) ........................................ Configures the Command Post window. detail - "SHORT" or "LONG" sort- "NAME",KIND","DATE","SIZE", or "UNSORTED" masks- which files to show If all parms = "", the current Command Post directory will be refreshed and displayed. SetDisplay("SHORT","NAME","*.*"); defalt SetDisplay("","","") ; update currdir SetDisplay("","","*.EXE *.COM *.BAT") ---------------------------------------- ---------------------------------------- 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) ---------------------------------------- ---------------------------------------- Terminate (condition, title, msg) ........................................ Tests a "condition", and cancels the menu item if it = @TRUE. If "title" or "msg" are not null strings, displays a message box before terminating. a=AskLine("Hi","Enter your age","") terminate(!IsNumber(a),"","Use numbers") terminate(a<1 || a>100),"ERR","Ha Ha") message("Hi","Your age is %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 Command Post program. a=Version() Message("Command Post","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". A pwn of "" is the current Command Post Window. Note: Some applications do not take kindly to having their window's title changed. WinTitle( "", "My Menu") ---------------------------------------- ---------------------------------------- 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 menu 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. run("this.exe","") run("that.exe","") run("andthe.exe","") run("other.exe","") Yield Message("All Done","Now what?") ----------------------------------------