home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / utils / command.zip / CP_INST.SFX / lha / CP_HELP.CRD (.txt) < prev    next >
Cardfile Document  |  1990-08-03  |  31KB  |  1,226 lines

  1. ----------------------------------------
  2.  @@  Command Post Language Summary  @@
  3. ........................................
  4. Copyright 1988-1990, Morrie Wilson
  5. All rights reserved.
  6.  
  7. This cardfile contains a quick summary of all the Command Post Menu Language functions -- and some other useful info  
  8.  
  9. Wilson WindowWare
  10. 2701 California Ave SW #212
  11. Seattle Wa, 98116
  12. (206) 937-9335    FAX (206) 935-7129
  13. ----------------------------------------
  14. ----------------------------------------
  15.  @@ Added Functions --  File Hiliting
  16. ........................................
  17. The following functions are not in the 7.0 manual:
  18.  
  19. FileHilite   ...Hilites/unhilites files
  20. ----------------------------------------
  21. ----------------------------------------
  22.  @@ Added Functions --  Info retrival
  23. ........................................
  24. The following functions are not in the 7.0 manual:
  25.  
  26. IsLicensed  ...Tells if CP licensed
  27. IsKeyDown   ...Tells about keys/mouse
  28. DOSVersion  ...Returns DOS/OS2 version
  29. WinConfig   ...Returns WIN3 mode flags
  30. WinPosition ...Returns Window position
  31. WinExist    ...Tells is Window exists
  32. ----------------------------------------
  33. ----------------------------------------
  34.  @@ Added Functions -- Filename Parsing
  35. ........................................
  36. The following functions are not in the 7.0 manual:
  37.  
  38. FileRoot       ...returns root of file
  39. FileExtension  ...returns ext of file
  40. FilePath       ...returns path of file 
  41. ----------------------------------------
  42. ----------------------------------------
  43.  @@ Added Functions -- Network Support
  44. ........................................
  45. The following functions are not in the 7.0 manual:
  46.  
  47. DiskReset ...re-examines available disks
  48. DiskHide  ...Hides disks from display
  49. ----------------------------------------
  50. ----------------------------------------
  51.  @@ Added Functions -- String Handling
  52. ........................................
  53. The following functions are not in the 7.0 manual:
  54.  
  55. StrReplace  ...Replaces all occurances
  56.                of a substring with                      another
  57. ----------------------------------------
  58. ----------------------------------------
  59.  @@ Mouse  - A Quickie Overview
  60. ........................................
  61. The following few cards discuss some of the mouse control of the CmdPost window.  Some shorthand notation used is:
  62.  
  63. LC   - Left Click
  64. RC   - Right Click
  65. LDBL - Left Double Click
  66. RDBL - Right Double Click
  67. ----------------------------------------
  68. ----------------------------------------
  69.  @@ Mouse - Disk switching
  70. ........................................
  71. LC the desired drive to switch the Command Post window to that drive.
  72.  
  73.  
  74. Keyboard equivalent is 
  75. CTRL-(whatever driveletter you need)
  76. ----------------------------------------
  77. ----------------------------------------
  78.  @@ Mouse - Navigating the Tree - DOWN
  79. ........................................
  80. Subdirectories are shown in BOLD type at the top of the file listing.
  81.  
  82. LC to select a subdir - clears all                               other selections
  83. RC to select a subdir - keeps other                              selections
  84. LDBL switch to selected subdir
  85. ----------------------------------------
  86. ----------------------------------------
  87.  @@ Mouse - Navigating the Tree - UP
  88. ........................................
  89. At the top of the file window, next to the disk drive icons is the current pathname. 
  90.  
  91. LC on the desired directory in the pathname to see that directory
  92.  
  93. Keyboard equivalent is using the BACKSPACE key to move up one level at a time.
  94. ----------------------------------------
  95. ----------------------------------------
  96.  @@ Mouse - On a file name
  97. ........................................
  98. LC   selects a file - clears all 
  99.      other selections
  100. RC   selects a file - keeps other 
  101.      selections.  Can DRAG the mouse.
  102.  
  103. LDBL runs selected file.  If not an 
  104.      EXE, COM, BAT, or PIF file, the          [extensions] of WIN.INI is used.
  105.  
  106. RDBL will select/unselect all files 
  107.      with the same extension.
  108. ----------------------------------------
  109. ----------------------------------------
  110.  @@ Mouse - Quickie Menu Items
  111. ........................................
  112. 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<-
  113. Some of these menuitems are:
  114. File.Browse         File.Copy
  115. File.NotepadEdit    File.Move
  116. File.Copy
  117. File.Move/Rename
  118. ----------------------------------------
  119. ----------------------------------------
  120.  @@ WIN.INI Variables
  121. ........................................
  122. 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\)  
  123. 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.
  124. [CmdPost]
  125. AutoUpdate=0
  126. ----------------------------------------
  127. ----------------------------------------
  128.  Menu Structure
  129. ........................................
  130. Main Menu Name A
  131.  DropDown Menu Name A-1
  132.     <statements>
  133.  DropDown menu Name A-2
  134.     <statements>
  135. Main Menu Name B
  136.  DropDown menu name B-1
  137.     <statements>
  138. ; Comment.
  139. ; Next line declares a 2nd .cpm file:
  140. #NextFile SECOND.CPM
  141. ----------------------------------------
  142. ----------------------------------------
  143.  Variables
  144. ........................................
  145. Variable names start with a letter.
  146.  
  147. The rest of the name consists of letters and numbers, up to 30 characters total.
  148.  
  149. Variable names are NOT case sensitive, i.e. "Cat" and "cAT" are the same variable.
  150. ----------------------------------------
  151. ----------------------------------------
  152. !
  153. ........................................
  154. The logical NOT operator.
  155.  
  156. Produces @TRUE if the operand = zero, @FALSE if it's nonzero.
  157. ----------------------------------------
  158. ----------------------------------------
  159. &      |      ^
  160. ........................................
  161. The bitwise AND, OR, and XOR operators.
  162.  
  163. The operator will arithmetically AND, OR, or exclusive-OR two integers together.  
  164.  
  165. a=5;        = 101
  166. b=4        = 100
  167. c=a & b  ; c=4    = 100
  168. d=a | b  ; d=5  = 101
  169. e=a ^ b  ; e=1  = 001
  170. ----------------------------------------
  171. ----------------------------------------
  172. &&    ||
  173. ........................................
  174. The logical AND and OR operators.
  175.  
  176. These operators will logically AND or OR two numbers together.  
  177.  
  178. a=0    ;0 means FALSE
  179. b=4    ;nonzero means TRUE
  180. c=a && b  ; c is @FALSE ( 0 )
  181. d=a || b  ; d is @TRUE  ( 1 )
  182.  
  183. See also & | and ^
  184. ----------------------------------------
  185. ----------------------------------------
  186. (   )
  187. ........................................
  188. Parentheses.
  189.  
  190. Parentheses are used to control the order an expression is evaluated.
  191.  
  192. a = (4+5) * 2    ; a is 18
  193. a = 4 + (5 * 2)  ; a is 14
  194. ----------------------------------------
  195. ----------------------------------------
  196. *   /   +   -    mod (binary)
  197. ........................................
  198. Simple arithmetic operators.
  199.  
  200. *   Multiplication
  201. /   Division
  202. +   Addition
  203. -   Subtraction
  204. mod Modulo  (divide, return remainder)
  205.  
  206. See also abs, min, max
  207. ----------------------------------------
  208. ----------------------------------------
  209. ~
  210. ........................................
  211. Bitwise NOT operator.
  212.  
  213. Sets all 0 bits of the integer operand to 1, and vice-versa.
  214.  
  215. a=26    ;=00110100
  216. b=~a    ;=11001011, or -27
  217. ----------------------------------------
  218. ----------------------------------------
  219. +   -   (unary)
  220. ........................................
  221. Unary arithmetic operators.
  222.  
  223. +  Identity
  224. -  Negation
  225. ----------------------------------------
  226. ----------------------------------------
  227. <<    >>
  228. ........................................
  229. Bitwise shift operators.
  230.  
  231. <<  Left Shift
  232. >>  Right Shift
  233.  
  234. c= 16 >> 2    ; c is 4
  235. d= 16 << 2    ; c is 64
  236. ----------------------------------------
  237. ----------------------------------------
  238. =
  239. ........................................
  240. The assigment operator.
  241.  
  242. Assigns the value or string evaluated on the right side of the = sign to the variable on the left side.
  243. ----------------------------------------
  244. ----------------------------------------
  245. ==   !=   <>   <=   >=   >   <
  246. ........................................
  247. Relational operators. 
  248.  
  249. ==      Equality
  250. !=  <>  Inequality
  251. <=      Less than or equal to
  252. >=      Greater than or equal to
  253. <       Less than
  254. >       Greater than
  255. These produce 0 (@FALSE) or 1 (@TRUE).
  256.  
  257. See also StrCmp, StrICmp
  258. ----------------------------------------
  259. ----------------------------------------
  260. Abs (number)
  261. ........................................
  262. Returns the absolute (positive) value of an integer number.
  263.  
  264.  
  265. Fred=Abs(-4)  ;Fred becomes 4
  266. ----------------------------------------
  267. ----------------------------------------
  268. AskLine (title, prompt, default)
  269. ........................................
  270. Gets a line of info from the user.
  271.  
  272. title  = title of the dialog box.
  273. prompt = question shown above edit box.
  274. default= default entry in edit box.
  275.  
  276. Returns string the user enters into the edit box.
  277. ----------------------------------------
  278. ----------------------------------------
  279. AskYesNo (title, prompt)
  280. ........................................
  281. Asks the user a yes or no question.
  282.  
  283. title    = title of the dialog box.
  284. prompt    = string shown above edit box.
  285.  
  286. Returns @YES or @NO depending on which button they press.
  287. ----------------------------------------
  288. ----------------------------------------
  289. Average (num [,num]...)
  290. ........................................
  291. Finds the average of a list of integers.
  292.  
  293. Returns average of the numbers, to the closest integer.
  294.  
  295.  
  296. ----------------------------------------
  297. ----------------------------------------
  298. Beep
  299. ........................................
  300. Sounds a short beep at the user.
  301.  
  302.  
  303.  
  304.  
  305. Beep
  306. Message("Be Alert","We need more lerts")
  307. ----------------------------------------
  308. ----------------------------------------
  309. Char2Num (string)
  310. ........................................
  311. Converts the first character of a string to its ANSI code.
  312.  
  313.  
  314.  
  315. a=Char2Num("Z")
  316. Message("Z's ANSI Code is",a)
  317. ----------------------------------------
  318. ----------------------------------------
  319. ClipAppend (string)
  320. ........................................
  321. Appends a string to the clipboard.  
  322. Clipboard must contain text, or be empty.
  323.  
  324. a="First"
  325. b="Second"
  326. ClipPut(a)
  327. ;clipboard = "First"
  328. ClipAppend(b)
  329. ;clipboard = "FirstSecond"
  330. ----------------------------------------
  331. ----------------------------------------
  332. ClipGet ()
  333. ........................................
  334. Retrieves the contents of the Clipboard into a string variable.  
  335. Clipboard must contain only text.
  336.  
  337. a=ClipGet()
  338. Message("Clipboard",a)
  339. ----------------------------------------
  340. ----------------------------------------
  341. ClipPut (string)
  342. ........................................
  343. Clears the clipboard and inserts a "string" into it.  Clipboard will be marked as containing text.
  344.  
  345.  
  346. a="First"
  347. b="Second"
  348. ClipPut(a)
  349. ;clipboard = "First"
  350. ClipAppend(b)
  351. ;clipboard = "FirstSecond"
  352. ----------------------------------------
  353. ----------------------------------------
  354. CurrentFile()
  355. ........................................
  356. Returns the currently selected filename. 
  357.  
  358. The currently selected file name is the one with the dashed box around it.
  359.  
  360. If could be a directory if that is what the dashed box is around.
  361. ----------------------------------------
  362. ----------------------------------------
  363. DateTime ()
  364. ........................................
  365. Returns the current system date and time using the format declared in the International section of the WIN.INI file.
  366.  
  367.  
  368. Message("Date and Time is",DateTime())
  369. ----------------------------------------
  370. ----------------------------------------
  371. Debug (@ON | @OFF)
  372. ........................................
  373. Turns the statement debugging dialog box on or off.
  374. ----------------------------------------
  375. ----------------------------------------
  376. Delay (seconds)
  377. ........................................
  378. Delays "seconds" seconds.  While the delay is in progress other windows will receive processing time.
  379.  
  380. message("TEST","See you later")
  381. delay(10)
  382. message("TEST","I'm BAAAAAACK!")
  383. ----------------------------------------
  384. ----------------------------------------
  385. DirChange ([d:] path)
  386. ........................................
  387. Changes the current directory.
  388.  
  389. If the pathname includes a different drive than the current one, it will log onto the new drive.
  390.  
  391.  
  392. DirChange ("d:\winword")
  393. DirChange ("mysubdir")
  394.  
  395. ----------------------------------------
  396. ----------------------------------------
  397. DirGet ()
  398. ........................................
  399. Returns the current directory.
  400. ----------------------------------------
  401. ----------------------------------------
  402. DirHome ()
  403. ........................................
  404. Returns the path to the Command Post executable files.
  405. ----------------------------------------
  406. ----------------------------------------
  407. DirItemize (dir-spec)
  408. ........................................
  409. Returns either all the highlighted directories (if dir-spec = "") or the list of directories matching a set of wildcards.  Usually "*.*" is used.
  410.  
  411. The directory names are separated by spaces.
  412.  
  413. DirItemize("")    ;returns hilited dirs
  414. DirItemize("*.*") ;returns all dirs
  415. ----------------------------------------
  416. ----------------------------------------
  417. DirMake ([d:] path)
  418. ........................................
  419. Creates a new directory.
  420.  
  421.  
  422. DirMake ("Child")
  423. DirMake ("..\..\Uncle")
  424. DirMake ("..\..\Uncle\Cousin")
  425. ----------------------------------------
  426. ----------------------------------------
  427. DirRemove ([d:] path)
  428. ........................................
  429. Deletes a directory.
  430.  
  431.  
  432. DirRemove ("..\..\Uncle\Cousin")
  433.  
  434. ----------------------------------------
  435. ----------------------------------------
  436. DiskFree (drive-list)
  437. ........................................
  438. Returns the total available free space of all drives in the list.
  439.  
  440. a=DiskFree("C D")  ;get free space
  441. a=a/1024           ;convert to "K"
  442. Message ("Free space on C&D","%a%K")
  443. ----------------------------------------
  444. ----------------------------------------
  445. DiskHide (Drive-Letter-List)
  446. ........................................
  447. Instructs Command Post to suppress the disk drive icon display for all drives in the Drive-Letter-List.
  448.  
  449. 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:
  450.  
  451. DiskHide("STUVW")  
  452. ----------------------------------------
  453. ----------------------------------------
  454. DiskReset ()
  455. ........................................
  456. 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.
  457. ----------------------------------------
  458. ----------------------------------------
  459. Display (seconds, title, text)
  460. ........................................
  461. Displays a message for the indicated number of seconds.
  462.  
  463. You can stop the display by clicking on the message box with the mouse or pressing a key.
  464.  
  465. Display(5,"!!!","Bye bye in 5 seconds")
  466. ----------------------------------------
  467. ----------------------------------------
  468. DOSVersion (@MAJOR | @MINOR)
  469. ........................................
  470. Returns the version numbers of the current version of DOS.
  471. "level" = @MAJOR returns the integer part and @MINOR returns the decimal part (to the right of the decimal).
  472.  
  473. r=DOSVersion(@MAJOR)
  474. v=DOSVersion(@MINOR)
  475. Message("DOS Version","%r%.%v%")
  476. ----------------------------------------
  477. ----------------------------------------
  478. Drop (var [,var]...)
  479. ........................................
  480. Deletes variables from the varaible list, thus conserving memory.
  481.  
  482. This is a recommended practice for local variables.
  483. ----------------------------------------
  484. ----------------------------------------
  485. EndSession ()
  486. ........................................
  487. Ends the current Windows session.
  488.  
  489. Has the same effect as choosing File/Exit in Win 2.x, or closing the Program Manager in Win 3.0
  490. ----------------------------------------
  491. ----------------------------------------
  492. Environment (env-variable)
  493. ........................................
  494. Returns the contents of a DOS environ- ment variable.
  495.  
  496. a=Environment("PATH")
  497. Message("Your PATH is",a)
  498. ----------------------------------------
  499. ----------------------------------------
  500. ErrorMode(@OFF | @NOTIFY | @CANCEL)
  501. ........................................
  502. Controls the error handling mode.  @CANCEL (the default):  Cancels the menu item at any error.
  503. @NOTIFY:  Informs the user and allows her to continue if the error is recoverable.
  504. @OFF: Same as @NOTIFY, but suppresses any recoverable errors.
  505.  
  506.  
  507. ERRORMODE(@OFF)
  508. ----------------------------------------
  509. ----------------------------------------
  510. Execute statement
  511. ........................................
  512. Executes a statement in an "error protected" environment.  Any error will be recoverable.  Often used to interactively execute user-typed statements.
  513.  
  514. A=AskLine("DO","Enter Stmt","")
  515. Execute %A%
  516. ----------------------------------------
  517. ----------------------------------------
  518. Exit
  519. ........................................
  520. Used to end processing a menu item.
  521.  
  522. Exit is assumed at the end of all menu items.
  523.  
  524.  
  525. b=0
  526. Exit
  527. ----------------------------------------
  528. ----------------------------------------
  529. FileCopy (from-list, to-name, warn)
  530. ........................................
  531. 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.
  532.  
  533. If "warn" is @TRUE, the user will get a warning before overwriting a file.
  534.  
  535. FileCopy("C:\win\*.*", "A:", @TRUE)
  536.  
  537. ----------------------------------------
  538. ----------------------------------------
  539. FileDelete (file-list)
  540. ........................................
  541. Deletes one or more files.  More than one filename may be specified.  Wildcards may be used.
  542.  
  543.  
  544. FileDelete("*.BAK *.OLD")
  545. ----------------------------------------
  546. ----------------------------------------
  547. FileExist (filename)
  548. ........................................
  549. Determines whether or not a file exists. 
  550.  
  551. Returns @TRUE or @FALSE.
  552.  
  553. Unless it is a full pathname, The current directory will be checked, and then all directories on the DOS PATH will be checked.
  554.  
  555. a=FileExist ("WIN.INI")
  556. a=FileExist ("c:\windows\win.ini")
  557. ----------------------------------------
  558. ----------------------------------------
  559. FileExtension (filename)
  560. ........................................
  561. FileExtension parses the passed filename and returns the extension part of the filename.
  562. ----------------------------------------
  563. ----------------------------------------
  564. FileHilite (masks,flag)
  565. ........................................
  566. Hilites or unhilites files
  567. masks -  which files to affect
  568. flag  -  @TRUE - Hilite matching files
  569.          @FALSE -Unhilite matching files
  570.  
  571.  
  572. FileHilite("*.ZIP *.LZH *.ARC",@TRUE)
  573. FileHilite("OLD*.ZIP",@FALSE)
  574.  
  575.  
  576.  
  577. ----------------------------------------
  578. ----------------------------------------
  579. FileItemize (file-list)
  580. ........................................
  581. Returns either a list of highlighted files (if file-list = "") or the list of files matching the set of wildcards specified.
  582.  
  583. The filenames are separated by spaces.
  584.  
  585. FileItemize("") ;returns hilited files
  586. FileItemize("*.BAK") ;returns all BAK's
  587. FileItemize("*.ARC *.ZIP *.LZH")
  588.       ;returns list of compressed files
  589. ----------------------------------------
  590. ----------------------------------------
  591. FileLocate (filename)
  592. ........................................
  593. 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.
  594.  
  595. a=FileLocate("WIN.INI")
  596. Message("WIN.INI is located in",a)
  597.  
  598. ----------------------------------------
  599. ----------------------------------------
  600. FileMove (from-list, to-name, warn)
  601. ........................................
  602. 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.
  603.  
  604. If the destination is on the same drive, a rename will occur instead of a move. 
  605. If "warn" = @TRUE the user gets a warning before overwriting a file.
  606.  
  607. FileMove("C:\win\*.*","A:",@TRUE)
  608. ----------------------------------------
  609. ----------------------------------------
  610. FilePath (filename)
  611. ........................................
  612. FilePath parses the passed filename and returns the drive and path of the file specification, if any.
  613. ----------------------------------------
  614. ----------------------------------------
  615. FileRename (file-list, to-name)
  616. ........................................
  617. 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.
  618.  
  619. The destination MUST be on the same drive as the source.  You may wish to use FileMove instead of FileRename. 
  620.  
  621. FileMove("C:\win\*.*","A:")
  622. ----------------------------------------
  623. ----------------------------------------
  624. FileRoot (filename)
  625. ........................................
  626. FileRoot parses the passed filename and returns the root part of the filename.
  627. ----------------------------------------
  628. ----------------------------------------
  629. FileSize (file-list)
  630. ........................................
  631. Adds the sizes of all the files in the list and returns the total.
  632.  
  633. a=FileSize(FileItemize("*.*"))
  634. Message("Size of all files in dir",a)
  635. ----------------------------------------
  636. ----------------------------------------
  637. IniRead (section, keyword, default)
  638. ........................................
  639. Looks up a value in the WIN.INI file.  If the value is not found, the "default" will be returned.
  640.  
  641. IniRead ("windows","device","none")
  642. will look in
  643.  
  644. [windows]
  645. device=...
  646.  
  647. and return the default ptr or "none".
  648. ----------------------------------------
  649. ----------------------------------------
  650. IniWrite (section, keyword, data)
  651. ........................................
  652. Modifies the WIN.INI file with the desired data.
  653.  
  654.  
  655.  
  656. IniWrite("CmdPost","MyVar",5)
  657. will create a new keyword entry in the CmdPost section:
  658.  
  659. [CmdPost]
  660. MyVar=5
  661. ----------------------------------------
  662. ----------------------------------------
  663. IsDefined (variable)
  664. ........................................
  665. Determines whether or not a variable has been defined.
  666.  
  667. Returns @YES or @NO.
  668.  
  669. ----------------------------------------
  670. ----------------------------------------
  671. IsKeyDown(key-codes)
  672. ........................................
  673. Determines if the SHIFT key or the CTRL key is currently down.
  674.     IsKeyDown(@SHIFT)
  675.     IsKeyDown(@CTRL)
  676.     IsKeyDown(@CTRL|@SHIFT)
  677.     IsKeyDown(@CTRL&@SHIFT)
  678.  
  679. Returns TRUE or FALSE.
  680. Note: Right Mouse button same as SHIFT
  681.       Middle button same as CTRL
  682. ----------------------------------------
  683. ----------------------------------------
  684. IsLicensed()
  685. ........................................
  686. Returns whether or not the current version of Command Post is a licensed copy or not.
  687.  
  688. 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.
  689. ----------------------------------------
  690. ----------------------------------------
  691. IsMenuChecked (menuname)
  692. ........................................
  693. Determines whether or not a menu item is currently checked.  Returns @YES or @NO.
  694.  
  695.  
  696. ----------------------------------------
  697. ----------------------------------------
  698. IsMenuEnabled (menuname)
  699. ........................................
  700. Determines whether or not a menu item is currently enabled (i.e. not grayed).  Returns @YES or @NO.
  701.  
  702. Terminate(!IsMenuEnabled,"ViewName","")
  703.  
  704. ----------------------------------------
  705. ----------------------------------------
  706. IsNumber (string)
  707. ........................................
  708. Determines if a string can be converted into a number.
  709.  
  710. Returns @YES or @NO.
  711.  
  712. n=AskLine("TEST","Enter a number",entry)
  713. Terminate(!IsNumber(entry),"Must Enter a
  714.                   Number")
  715.  
  716. ----------------------------------------
  717. ----------------------------------------
  718. IsRunning ()
  719. ........................................
  720. Returns @TRUE if another copy of Command Post is already running.
  721.  
  722. Returns @FALSE if this is the first instance of Command Post.
  723. ----------------------------------------
  724. ----------------------------------------
  725. Itemselect (title, list, delimiter)
  726. ........................................
  727. 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.
  728.  
  729. a=FileItemize("*.DOC")
  730. a=ItemSelect("Files",a," ")
  731. b=WinItemize()
  732. b=ItemSelect("Windows",b,char2num(9))
  733. ----------------------------------------
  734. ----------------------------------------
  735. LastError ()
  736. ........................................
  737. Returns a numeric value representing the last error that occurred.  Each error has a different value.  0 means no error occurred.   
  738.  
  739. To use use LastError, ErrorMode() must be set to @NOTIFY or @OFF to avoid the default @CANCEL on error recovery.
  740. ----------------------------------------
  741. ----------------------------------------
  742. LogDisk (diskdrive)
  743. ........................................
  744. Selects the first character of the "diskdrive" string and logs that disk as the current disk.
  745.  
  746. DirChange will log a new drive if the pathname you want to change to is on a different one than the current one.
  747.  
  748. LogDisk("D")
  749.  
  750.  
  751. ----------------------------------------
  752. ----------------------------------------
  753. Max (num [,num]...)
  754. ........................................
  755. Examines a series of integers and returns the largest number in the list.
  756.  
  757.  
  758. a=max(100, -50, 30, 200, 10)
  759. message("answer will be 200",a)
  760. ----------------------------------------
  761. ----------------------------------------
  762. MenuChange (menuname, flags)
  763. ........................................
  764. Changes a menu item to be checked or unchecked, enabled or disabled(grayed).
  765.  
  766. The permissable flags are
  767. @CHECK or @UNCHECK
  768. @ENABLE or @DISABLE
  769.  
  770. @CHECK or @UNCHECK may be or'ed with @ENABLE or @DISABLE using the | operator.
  771. ----------------------------------------
  772. ----------------------------------------
  773. Message (title, text)
  774. ........................................
  775. Displays a message box to the user, with a specified "title" and "text".
  776.  
  777. There will be an OK button for the user to press.
  778.  
  779. Message("Hello","This is an example.")
  780. ----------------------------------------
  781. ----------------------------------------
  782. Min (num [,num]...)
  783. ........................................
  784. Examines a series of integers and returns the smallest number in the list.
  785.  
  786.  
  787. a=min(100, -50, 30, 200, 10)
  788. message("answer will be -50", a)
  789. ----------------------------------------
  790. ----------------------------------------
  791. Num2Char (number)
  792. ........................................
  793. Converts a number to a one-character string.  Use this to display special ANSI characters.
  794.  
  795. tab=num2char(9)
  796. c=num2char(169) ;(c) symbol
  797. Message("Command Post", "%c%1990")
  798.  
  799.  
  800.  
  801. ----------------------------------------
  802. ----------------------------------------
  803. OtherDir ()
  804. ........................................
  805. Returns the drive and directory that the "other" (second-most recently used) Command Post window is set to.
  806.  
  807. 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.
  808.  
  809. a=OtherDir()
  810. Message("The Other Directory is",a)
  811. ----------------------------------------
  812. ----------------------------------------
  813. OtherUpdate ()
  814. ........................................
  815. 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
  816. desirable.
  817. ----------------------------------------
  818. ----------------------------------------
  819. Pause (title, text)
  820. ........................................
  821. Presents the user with a message box, using the "title" and "text" supplied.
  822. The box has two buttons - OK and CANCEL. 
  823. If OK is selected, processing continues. 
  824. If CANCEL is selected, processing terminates.
  825.  
  826. Pause("Hey You","Insert Floppy in A:")
  827. FileCopy("C:\DOC\*.DOC","A:")
  828. ----------------------------------------
  829. ----------------------------------------
  830. Random (max)
  831. ........................................
  832. Returns a psuedo-random integer between 0 and "max".
  833.  
  834. A=Random(10)    ; between 0 and 10
  835. B=Random(20)    ; between 0 and 20
  836. c=Random(10)+10 ; between 10 and 20
  837. ----------------------------------------
  838. ----------------------------------------
  839. Run     (program, parameters)
  840. ........................................
  841. Runs a "program" with the specified "parameters".
  842.  
  843. The program's window is passed a request to show itself as a default window size & position.
  844.  
  845. Run("notepad.exe","win.ini")
  846. run("Clock.exe","") ; note empty parms
  847.  
  848. ----------------------------------------
  849. ----------------------------------------
  850. RunHide (program, parameters)
  851. ........................................
  852. Runs a "program" with the specified "parameters".
  853.  
  854. The program's window is passed a request to hide itself.
  855.  
  856.  
  857. RunHide("notepad.exe","win.ini")
  858. runHide("Clock.exe","") ; no parms
  859.  
  860. ----------------------------------------
  861. ----------------------------------------
  862. RunIcon (program, parameters)
  863. ........................................
  864. Runs a "program" with the specified "parameters".
  865.  
  866. The program's window is passed a request to show itself as an icon ('minimized' window).
  867.  
  868.  
  869. RunIcon("notepad.exe","win.ini")
  870. runIcon("Clock.exe","") ; no parms
  871.  
  872. ----------------------------------------
  873. ----------------------------------------
  874. RunZoom (program, parameters)
  875. ........................................
  876. Runs a "program" with the specified "parameters".
  877.  
  878. The program's window is passed a request to show itself as a full-screen ('maximized') window.
  879.  
  880.  
  881. RunZoom("notepad.exe","win.ini")
  882. runZoom("sol.exe","") ; no parms
  883.  
  884. ----------------------------------------
  885. ----------------------------------------
  886. SetDisplay (detail, sort, masks)
  887. ........................................
  888. Configures the Command Post window.
  889. detail -  "SHORT" or "LONG"
  890. sort-      "NAME",KIND","DATE","SIZE",
  891.                or "UNSORTED"
  892. masks-  which files to show
  893. If all parms = "", the current Command Post directory will be refreshed and displayed.
  894. SetDisplay("SHORT","NAME","*.*"); defalt
  895. SetDisplay("","","") ; update currdir
  896. SetDisplay("","","*.EXE *.COM *.BAT")
  897. ----------------------------------------
  898. ----------------------------------------
  899. StrCat (string [,string]...)
  900. ........................................
  901. Concatenates any number of strings together and returns the concatenated string.
  902.  
  903. crlf=strcat(num2char(13),num2char(10))
  904. a=strcat("line1",crlf,"line2")
  905. ;a="line1
  906. line2"
  907. ----------------------------------------
  908. ----------------------------------------
  909. StrCmp (string1, string2)
  910. ........................................
  911. Compares two strings and return one of three possible values:
  912.  
  913. if "string1" is before "string2"  -1
  914. if "string1" equals    "string2"   0
  915. if "string1" is after  "string2"   1
  916.  
  917.  
  918. ----------------------------------------
  919. ----------------------------------------
  920. StrFill (source, length)
  921. ........................................
  922. Creates a string by concatenating multiple copies of the "source" string to itself until the string length equals "length".
  923.  
  924.  
  925. aa=Strfill("*",20)
  926. message("20 Stars",aa)
  927. ----------------------------------------
  928. ----------------------------------------
  929. StrFix (base, pad, length)
  930. ........................................
  931. 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.
  932. ----------------------------------------
  933. ----------------------------------------
  934. StrICmp (string1, string2)
  935. ........................................
  936. Compares two strings and returns one of three possible values, IGNORING CASE:
  937.  
  938. if "string1" is before "string2"  -1
  939. if "string1" equals    "string2"   0
  940. if "string1" is after  "string2"   1
  941. ----------------------------------------
  942. ----------------------------------------
  943. StrIndex (string, substring, start, dir)
  944. ........................................
  945. 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.  
  946. example: to parse filename:
  947. a=CurrentFile()
  948. i=strindex(a,".",1,@FWDSCAN)
  949. root=strsub(a,1,i-1)
  950. ext =strsub(a,i+1,strlen(a)-i)
  951. ----------------------------------------
  952. ----------------------------------------
  953. StrLen (string)
  954. ........................................
  955. Returns the length of a "string".
  956.  
  957. a="ABCDE"
  958. Message("Length of ABCDE is",strlen(a))
  959. ----------------------------------------
  960. ----------------------------------------
  961. StrLower (string)
  962. ........................................
  963. Returns the lowercase version of a "string".
  964.  
  965. a=AskLine("Please","Enter Name","")
  966. a=strlower(a)
  967. b=strsub(a,1,1)
  968. b=strupper(b)
  969. c=strsub(a,2,strlen(a)-1)
  970. a=strcat(b,c)
  971. Message("Thanx",a)
  972. ----------------------------------------
  973. ----------------------------------------
  974. StrReplace(string,old,new)
  975. ........................................
  976. StrReplace scans the 'string', searching for occurrances of 'old' and replacing each occurrance with 'new'.
  977. e.g. Copy highlited files to clipboard:
  978.  
  979.   a=FileItemize("")
  980.   crlf=StrCat(Num2Char(13),Num2Char(10))
  981.   StrReplace(a," ",crlf)
  982.   ClipPut(a)
  983. ----------------------------------------
  984. ----------------------------------------
  985. StrScan (main, delims, start, dir)
  986. ........................................
  987. 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
  988. or @BACKSCAN.
  989. ----------------------------------------
  990. ----------------------------------------
  991. StrSub (string, start, length)
  992. ........................................
  993. Returns the substring of "string" which starts in position "start" and goes for "length" characters.
  994. ----------------------------------------
  995. ----------------------------------------
  996. StrTrim (string)
  997. ........................................
  998. Removes all leading and training spaces, if any, from "string" and returns the trimmed string.
  999. ----------------------------------------
  1000. ----------------------------------------
  1001. StrUpper (string)
  1002. ........................................
  1003. Returns the uppercase version of a "string".
  1004.  
  1005. a=AskLine("Please","Enter Name","")
  1006. a=strlower(a)
  1007. b=strsub(a,1,1)
  1008. b=strupper(b)
  1009. c=strsub(a,2,strlen(a)-1)
  1010. a=strcat(b,c)
  1011. Message("Thanx",a)
  1012. ----------------------------------------
  1013. ----------------------------------------
  1014. Terminate (condition, title, msg)
  1015. ........................................
  1016. Tests a "condition", and cancels the menu item if it = @TRUE.
  1017.  
  1018. If "title" or "msg" are not null strings, displays a message box before terminating.
  1019.  
  1020. a=AskLine("Hi","Enter your age","")
  1021. terminate(!IsNumber(a),"","Use numbers")
  1022. terminate(a<1 || a>100),"ERR","Ha Ha")
  1023. message("Hi","Your age is %a%")
  1024. ----------------------------------------
  1025. ----------------------------------------
  1026. TextBox (title, filename)
  1027. ........................................
  1028. Displays a file in a listbox with a "title".  It may be used for multiline messages or instructions.
  1029.  
  1030. If the user highlights a line, it will be returned as a text string, thus TextBox can also be used as a selection box.
  1031.  
  1032. TextBox("CONFIG.SYS","C:\CONFIG.SYS")
  1033. ----------------------------------------
  1034. ----------------------------------------
  1035. Version ()
  1036. ........................................
  1037. Returns the version of the current Command Post program.
  1038.  
  1039.  
  1040. a=Version()
  1041. Message("Command Post","Version %a%")
  1042. ----------------------------------------
  1043. ----------------------------------------
  1044. WinActivate (partialwindowname)
  1045. ........................................
  1046. Activates the named window.  Only the first part of the "partialwindowname" is required.
  1047.  
  1048.  
  1049. a=WinItemize()
  1050. a=ItemSelect("Choose a Window",a)
  1051. WinActivate(a)
  1052.  
  1053. ----------------------------------------
  1054. ----------------------------------------
  1055. WinArrange (style)
  1056. ........................................
  1057. Tiles, stacks, arranges in rows or arranges in columns the various open windows on the screen.
  1058.  
  1059. "style" may be @ROWS or @COLUMNS
  1060.         or @STACK or @ARRANGE
  1061.  
  1062. WinArrange("Stack")
  1063. ----------------------------------------
  1064. ----------------------------------------
  1065. WinClose (partialwindowname)
  1066. ........................................
  1067. Closes the first window found in which the first part of the windows name matches "partialwindowname".
  1068.  
  1069.  
  1070. WinClose("Clock")
  1071. WinClose("Clo")
  1072. ----------------------------------------
  1073. ----------------------------------------
  1074. WinCloseNot (pwn [,pwn]...)
  1075. ........................................
  1076. Closes all the windows EXCEPT the ones that match the "partialwindowname"s in the parameter list.
  1077.  
  1078.  
  1079. WinCloseNot("MS-DOS","Clock","PageMa")
  1080. ----------------------------------------
  1081. ----------------------------------------
  1082. WinConfig ()
  1083. ........................................
  1084. Returns the Windows configuration information as a number.  Bits are defined as follows:
  1085.  
  1086. 1  Protect Mode  |  64 8086 CPU     
  1087. 2  80286 CPU     | 128 80186 CPU 
  1088. 4  80386 CPU     | 256 Large PageFrame
  1089. 8  80486 CPU     | 512 Small PageFrame
  1090. 16 Standard Mode |1024 80x87 Installed
  1091. 32 Enhanced Mode |
  1092. ----------------------------------------
  1093. ----------------------------------------
  1094. WinExist (partialwindowname)
  1095. ........................................
  1096. Returns @TRUE or @FALSE, depending on whether a matching window can be found.
  1097.  
  1098.  
  1099.  
  1100.  
  1101. a=WinExist("Clock")
  1102.  
  1103. ----------------------------------------
  1104. ----------------------------------------
  1105. WinGetActive ()
  1106. ........................................
  1107. Returns the complete title of the currently active window.
  1108.  
  1109. Unless a WinActivate or other command was used, WinGetActive will generally return the current Command Post's window title.
  1110.  
  1111. a=WinGetActive()
  1112. Message("Active window was",a)
  1113. ----------------------------------------
  1114. ----------------------------------------
  1115. WinHide (partialwindowname)
  1116. ........................................
  1117. 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.
  1118.  
  1119. run("clock.exe","")
  1120. WinHide("Clock")
  1121. ----------------------------------------
  1122. ----------------------------------------
  1123. WinIconize (partialwindowname)
  1124. ........................................
  1125. Iconizes ('minimizes') the first window in which the first part of the window name matches "partialwindowname". 
  1126.  
  1127. Run("Clock.exe","")
  1128. WinIconize("Clock")
  1129.  
  1130. ;equivalent to
  1131. RunIcon("Clock.exe","")
  1132. ----------------------------------------
  1133. ----------------------------------------
  1134. WinItemize ()
  1135. ........................................
  1136. Returns a list of all the currently- running windows, by window title, separated by tabs within the string.
  1137.  
  1138. ;Closes selected window
  1139. a=WinItemize()
  1140. a=ItemSelect("CLOSE",a)
  1141. WinCLose(a)
  1142. ----------------------------------------
  1143. ----------------------------------------
  1144. WinPlace (x-ul, y-ul, x-br, y-br, pwn)
  1145. ........................................
  1146. Places and sizes a window anywhere on the screen.  Use the WININFO.EXE utility to help write the WinPlace statements.
  1147.  
  1148. x-ul   x co-ordinate upper left
  1149. y-ul   y co-ordinate upper left
  1150. x-br   x co-ordinate bottom right
  1151. y-br   y co-ordinate bottom right
  1152. pwn    partial window name
  1153.  
  1154. WinPlace(10,10,300,300,"Clock")
  1155. ----------------------------------------
  1156. ----------------------------------------
  1157. WinPosition (partialwindowname)
  1158. ........................................
  1159. Returns the current Window position information for the selected Window.  It returns 4 comma separated numbers.
  1160.  
  1161. a=WinPosition("Clock")
  1162.  
  1163. A return value for the above function might be "0,0,100,100".
  1164. ----------------------------------------
  1165. ----------------------------------------
  1166. WinShow (partialwindowname)
  1167. ........................................
  1168. Shows the first window in which the first part of the window name matches "partialwindowname".  
  1169.  
  1170. runhide("clock.exe","")
  1171. WinShow("Clock")
  1172. ----------------------------------------
  1173. ----------------------------------------
  1174. WinTitle (pwn, new-name)
  1175. ........................................
  1176. 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".
  1177. A pwn of "" is the current Command Post Window.
  1178. Note:  Some applications do not take kindly to having their window's title changed.
  1179.  
  1180. WinTitle( "", "My Menu")
  1181. ----------------------------------------
  1182. ----------------------------------------
  1183. WinVersion (@MAJOR | @MINOR)
  1184. ........................................
  1185. Returns the version numbers of the current version of Windows.
  1186. "level" = @MAJOR returns the integer part and @MINOR returns the decimal part (to the right of the decimal).
  1187.  
  1188. r=WinVersion(@MAJOR)
  1189. v=WinVersion(@MINOR)
  1190. Message("Windows Version","%r%.%v%")
  1191. ----------------------------------------
  1192. ----------------------------------------
  1193. WinWaitClose (partialwindowname)
  1194. ........................................
  1195. Suspends menu execution until there are no windows in which the first part of the window title matches "partialwindowname".
  1196.  
  1197. run("notepad.exe","special.txt")
  1198. Message("Edit file","Close when done")
  1199. WinWaitClose("Notepad")
  1200. Message("Edit file","You may continue")
  1201. ----------------------------------------
  1202. ----------------------------------------
  1203. WinZoom (partialwindowname)
  1204. ........................................
  1205. Zooms ('maximizes') the first window in which the first part of the window name matches "partialwindowname".  
  1206.  
  1207.  
  1208. Run("clock.exe","")
  1209. WinZoom("Clock")
  1210.  
  1211. ;equivalent to
  1212. RunZoom("clock.exe","")
  1213. ----------------------------------------
  1214. ----------------------------------------
  1215. Yield
  1216. ........................................
  1217. Suspends menu execution for enough time for other windows to process a few messages.
  1218.  
  1219. run("this.exe","")
  1220. run("that.exe","")
  1221. run("andthe.exe","")
  1222. run("other.exe","")
  1223. Yield
  1224. Message("All Done","Now what?")
  1225. ----------------------------------------
  1226.