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