home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / k95 / ras / script.txt < prev    next >
Text File  |  2020-01-01  |  13KB  |  482 lines

  1. Dial-Up Scripting Command Language
  2. For Dial-Up Networking Scripting Support
  3.  
  4.  
  5. Copyright (c) 1995 Microsoft Corp.
  6.  
  7.  
  8. Table of Contents
  9.  
  10. 1.0     Overview
  11. 2.0     Basic Structure of a Script
  12. 3.0     Variables
  13. 3.1     System Variables
  14. 4.0     String Literals
  15. 5.0     Expressions
  16. 6.0     Comments
  17. 7.0     Keywords
  18. 8.0     Commands
  19. 9.0     Reserved Words
  20.  
  21.  
  22.  
  23. 1.0   Overview
  24.  
  25. Many Internet service providers and online services require you to manually
  26. enter information, such as your user name and password, to establish a
  27. connection. With Scripting support for Dial-Up Networking, you can write a
  28. script to automate this process.
  29.  
  30. A script is a text file that contains a series of commands, parameters, and
  31. expressions required by your Internet service provider or online service to
  32. establish the connection and use the service.  You can use any text editor,
  33. such as Microsoft Notepad, to create a script file. Once you've created your
  34. script file, you can then assign it to a specific Dial-Up Networking
  35. connection by running the Dial-Up Scripting Tool.
  36.  
  37.  
  38. 2.0   Basic Structure of a Script
  39.  
  40. A command is the basic instruction that a script file contains. Some commands
  41. require parameters that further define what the command should do. An
  42. expression is a combination of operators and arguments that create a
  43. result. Expressions can be used as values in any command.  Examples of
  44. expressions include arithmetic, relational comparisons, and string
  45. concatenations.
  46.  
  47. The basic form of a script for Dial-Up Networking follows:
  48.  
  49. ;
  50. ; A comment begins with a semi-colon and extends to
  51. ; the end of the line.
  52. ;
  53.  
  54. proc main
  55. ;  A script can have any number of variables
  56. ;  and commands
  57.  
  58.         variable declarations
  59.  
  60.         command block
  61.  
  62. endproc
  63.  
  64. A script must have a main procedure, specified by the proc keyword, and a
  65. matching endproc keyword, indicating the end of the procedure.
  66.  
  67. You must declare variables before you add commands. The first command in the
  68. main procedure is executed, and then any subsequent commands are executed in
  69. the order they appear in the script. The script ends when the end of the main
  70. procedure is reached.
  71.  
  72.  
  73. 3.0   Variables
  74.  
  75. Scripts may contain variables. Variable names must begin with a letter or an
  76. underscore ('_'), and may contain any sequence of upper- or lower-case
  77. letters, digits, and underscores. You cannot use a reserved word as a variable
  78. name. For more information, see the list of reserved words at the end of this
  79. document.
  80.  
  81. You must declare variables before you use them. When you declare a variable,
  82. you must also define its type. A variable of a certain type may only contain
  83. values of that same type. The following three types of variables are
  84. supported:
  85.  
  86.         Type            Description
  87.  
  88. integer A negative or positive number, such as 7, -12, or 5698.
  89.  
  90. string A series of characters enclosed in double-quotes; for example, "Hello
  91. world!" or "Enter password:".
  92.  
  93. boolean A logical boolean value of TRUE or FALSE.
  94.  
  95. Variables are assigned values using the following assignment statement:
  96.  
  97. variable = expression
  98.  
  99. The variable gets the evaluated expression.
  100.  
  101. Examples:
  102.  
  103. integer count = 5
  104. integer timeout = (4 * 3)
  105. integer i
  106.  
  107. boolean bDone = FALSE
  108.  
  109. string szIP = (getip 2)
  110.  
  111. set ipaddr szIP
  112.  
  113.  
  114. 3.1   System Variables
  115.  
  116. System variables are set by scripting commands or are determined by the
  117. information your enter when you set up a Dial-Up Networking connection. System
  118. variables are read-only, which means they cannot be changed within the
  119. script. The system variables are:
  120.  
  121. Name            Type            Description
  122.  
  123. $USERID         String          The user identification for the current
  124.                                 connection. This variable is the value of the
  125.                                 user name specified in the Dial-Up Networking
  126.                                 Connect To dialog box.
  127.  
  128. $PASSWORD       String          The password for the current connection. This
  129.                                 variable is the value of the user name
  130.                                 specified in the Dial-Up Networking Connect To
  131.                                 dialog box.
  132.  
  133. $SUCCESS        Boolean         This variable is set by certain commands to
  134.                                 indicate whether or not the command
  135.                                 succeeded. A script can make decisions based
  136.                                 upon the value of this variable.
  137.  
  138. $FAILURE        Boolean         This variable is set by certain commands to
  139.                                 indicate whether or not the command failed. A
  140.                                 script can make decisions based upon the value
  141.                                 of this variable.
  142.  
  143. These variables may be used wherever an expression of a similar type is
  144. used. For example,
  145.  
  146. transmit $USERID
  147.  
  148. is a valid command because $USERID is a variable of type string.
  149.  
  150.  
  151. 4.0   String Literals
  152.  
  153. Scripting for Dial-Up Networking supports escape sequences and caret
  154. translations, as described below.
  155.  
  156.         String Literal  Description
  157.  
  158. ^char   Caret translation
  159.  
  160. If char is a value between '@' and '_', the character sequence is translated
  161. into a single-byte value between 0 and 31.  For example, ^M is converted to a
  162. carriage return.
  163.  
  164. If char is a value between a and z, the character sequence is translated
  165. into a single-byte value between 1 and 26.
  166.  
  167. If char is any other value, the character sequence is not specially treated.
  168.  
  169. <cr>    Carriage return
  170. <lf>    Linefeed
  171. \"      Double-quote
  172. \^      Single caret
  173. \<      Single '<'
  174. \\      Backslash
  175.  
  176. Examples:
  177.  
  178. transmit "^M"
  179. transmit "Joe^M"
  180. transmit "<cr><lf>"
  181. waitfor "<cr><lf>"
  182.  
  183.  
  184. 5.0    Expressions
  185.  
  186. An expression is a combination of operators and arguments that evaluates to a
  187. result.  Expressions can be used as values in any command.
  188.  
  189. An expression can combine any variable, or integer, string, or boolean values
  190. with any of the unary and binary operators in the following tables. All unary
  191. operators take the highest precedence. The precedence of binary operators is
  192. indicated by their position in the table.
  193.  
  194. The unary operators are:
  195.  
  196.         Operator        Type of Operation
  197.  
  198.         -               Unary minus
  199.         !               One's complement
  200.  
  201. The binary operators are listed in the following table in their order of
  202. precedence. Operators with higher precedence are listed first:
  203.  
  204.         Operators       Type of Operation       Type Restrictions
  205.  
  206.         *  /            Multiplicative          Integers
  207.         +  -            Additive                integers, Strings (+ only)
  208.         < > <= >=       Relational              Integers
  209.         == !=           Equality                Integers, strings, booleans
  210.         and             Logical AND             Booleans
  211.         or              Logical OR              Booleans
  212.  
  213. Examples:
  214.  
  215. count = 3 + 5 * 40
  216. transmit "Hello" + " there"
  217. delay 24 / (7 - 1)
  218.  
  219. 6.0   Comments
  220.  
  221. All text on a line following a semicolon is ignored.
  222.  
  223. Examples:
  224.  
  225. ; this is a comment
  226.  
  227. transmit "hello"                ; transmit the string "hello"
  228.  
  229. 7.0   Keywords
  230.  
  231. Keywords specify the structure of the script. Unlike commands, they do not
  232. perform an action.  The keywords are listed below.
  233.  
  234. proc name
  235.  
  236. Indicates the beginning of a procedure. All scripts must have a main procedure
  237. (proc main). Script execution starts at the main procedure and terminates at
  238. the end of the main procedure.
  239.  
  240. endproc
  241.  
  242. Indicates the end of a procedure. When the script is executed to the endproc
  243. statement for the main procedure, Dial-Up Networking will start PPP or SLIP.
  244.  
  245. integer name [ = value ]
  246.  
  247. Declares a variable of type integer. You can use any numerical expression or
  248. variable to initialize the variable.
  249.  
  250. string name [ = value ]
  251.  
  252. Declares a variable of type string. You can use any string literal or variable
  253. to initialize the variable.
  254.  
  255. boolean name [ = value ]
  256.  
  257. Declares a variable of type boolean. You can use any boolean expression or
  258. variable to initialize the variable.
  259.  
  260.  
  261. 8.0   Commands
  262.  
  263. All commands are reserved words, which means you cannot declare variables that
  264. have the same names as the commands. The commands are listed below:
  265.  
  266. delay nSeconds
  267.  
  268. Pauses for the number of seconds specified by nSeconds before executing the
  269. next command in the script.
  270.  
  271. Examples:
  272.  
  273. delay 2 ; pauses for 2 seconds
  274. delay x * 3     ; pauses for x * 3 seconds
  275.  
  276. getip  value
  277.  
  278. Waits for an IP address to be received from the remote computer. If your
  279. Internet service provider returns several IP addresses in a string, use the
  280. value parameter to specify which IP address the script should use.
  281.  
  282. Examples:
  283.  
  284. ; get the second IP address
  285. set ipaddr getip 2
  286.  
  287. ; assign the first received IP address to a variable
  288. szAddress = getip
  289.  
  290. goto label
  291.  
  292. Jumps to the location in the script specified by label and continues executing
  293. the commands following it.
  294.  
  295. Example:
  296.  
  297.   waitfor "Prompt>" until 10
  298.   if !$SUCCESS then
  299.         goto BailOut    ; jumps to BailOut and executes commands
  300.                         ; following it
  301.   endif
  302.  
  303.   transmit "bbs^M"
  304.   goto End
  305.  
  306. BailOut:
  307.   transmit "^M"
  308.  
  309.  
  310. halt
  311.  
  312. Stops the script. This command does not remove the terminal dialog window. You
  313. must click Continue to establish the connection. You cannot restart the
  314. script.
  315.  
  316.  
  317. if condition then
  318.                 commands
  319.         endif
  320.  
  321. Executes the series of commands if condition is TRUE.
  322.  
  323. Example:
  324.  
  325. if $USERID == "John" then
  326.         transmit "Johnny^M"
  327. endif
  328.  
  329.  
  330. label :
  331.  
  332. Specifies the place in the script to jump to. A label must be a unique name
  333. and follow the naming conventions of variables.
  334.  
  335.  
  336. set port databits 5 | 6 | 7 | 8
  337.  
  338. Changes the number of bits in the bytes that are transmitted and received
  339. during the session. The number of bits can be between 5 and 8. If you do not
  340. include this command, Dial-Up Networking will use the properties settings
  341. specified for the connection.
  342.  
  343. Example:
  344.  
  345.         set port databits 7
  346.  
  347.  
  348. set port parity none | odd | even | mark | space
  349.  
  350. Changes the parity scheme for the port during the session. If you do not
  351. include this command, Dial-Up Networking will use the properties settings
  352. specified for the connection.
  353.  
  354. Example:
  355.  
  356.         set port parity even
  357.  
  358.  
  359. set port stopbits 1 | 2
  360.  
  361. Changes the number of stop bits for the port during the session. This number
  362. can be either 1 or 2. If you do not include this command, Dial-Up Networking
  363. uses the properties settings specified for the connection.
  364.  
  365. Example:
  366.  
  367.         set port stopbits 2
  368.  
  369.  
  370. set screen keyboard  on | off
  371.  
  372. Enables or disables keyboard input in the scripting terminal window.
  373.  
  374. Example:
  375.  
  376.         set screen keyboard on
  377.  
  378.  
  379. set ipaddr string
  380.  
  381. Specifies the IP address of the workstation for the session. String must be in
  382. the form of an IP address.
  383.  
  384. Examples:
  385.  
  386. szIPAddress = "11.543.23.13"
  387. set ipaddr szIPAddress
  388.  
  389. set ipaddr "11.543.23.13"
  390.  
  391. set ipaddr getip
  392.  
  393.  
  394. transmit string [ , raw ]
  395.  
  396. Sends the characters specified by string to the remote computer.
  397.  
  398. The remote computer will recognize escape sequences and caret translations,
  399. unless you include the raw parameter with the command. The raw parameter is
  400. useful when transmitting $USERID and $PASSWORD system variables when the user
  401. name or password contains character sequences that, without the raw parameter,
  402. would be interpreted as caret or escape sequences.
  403.  
  404. Examples:
  405.  
  406. transmit "slip" + "^M"
  407. transmit $USERID, raw
  408.  
  409.  
  410. waitfor string [ , matchcase ] [ then label
  411.         { , string [ , matchcase ] then label } ]
  412.         [ until time ]
  413.  
  414. Waits until your computer receives one or more of the specified strings from
  415. the remote computer. The string parameter is case-insensitive, unless you
  416. include the matchcase parameter.
  417.  
  418. If a matching string is received and the then label parameter is used, this
  419. command will jump to the place in the script file designated by label.
  420.  
  421. The optional until time parameter defines the maximum number of seconds that
  422. your computer will wait to receive the string before it execute the next
  423. command. Without this parameter, your computer will wait forever.
  424.  
  425. If your computer receives one of the specified strings, the system variable
  426. $SUCCESS is set to TRUE. Otherwise, it is set to FALSE if the number of
  427. seconds specified by time elapses before the string is received.
  428.  
  429. Examples:
  430.  
  431. waitfor "Login:"
  432.  
  433. waitfor "Password?", matchcase
  434.  
  435. waitfor "prompt>" until 10
  436.  
  437. waitfor
  438.         "Login:"        then DoLogin,
  439.         "Password:"     then DoPassword,
  440.         "BBS:"          then DoBBS,
  441.         "Other:"        then DoOther
  442.   until 10
  443.  
  444.  
  445. while condition do
  446.                 commands
  447. endwhile
  448.  
  449. Executes the series of commands until condition is FALSE.
  450.  
  451. Example:
  452.  
  453. integer count = 0
  454.  
  455. while count < 4 do
  456.         transmit "^M"
  457.         waitfor "Login:" until 10
  458.         if $SUCCESS then
  459.                 goto DoLogin
  460.         endif
  461.         count = count + 1
  462. endwhile
  463.         ...
  464.  
  465.  
  466. 9.0   Reserved Words
  467.  
  468. The following words are reserved and may not be used as variable names.
  469.  
  470.         and             boolean         databits        delay
  471.         do              endif           endproc         endwhile
  472.         even            FALSE           getip           goto
  473.         halt            if              integer         ipaddr
  474.         keyboard        mark            matchcase       none
  475.         odd             off             on              or
  476.         parity          port            proc            raw
  477.         screen          set             space           stopbits
  478.         string          then            transmit        TRUE
  479.         until           waitfor         while
  480.  
  481. (End)
  482.