home *** CD-ROM | disk | FTP | other *** search
/ Windows Shareware GOLD / NuclearComputingVol3No1.cdr / apps / f1340 / wb_help.crd (.txt) < prev    next >
Cardfile Document  |  1991-03-02  |  30KB  |  1,229 lines

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