home *** CD-ROM | disk | FTP | other *** search
/ Freesoft 1999 February / Freesoft_1999-02_cd.bin / Nerecenz / Utils / autoit_v1_4.exe / AutoIt.txt < prev    next >
Text File  |  1999-01-20  |  11KB  |  387 lines

  1. AutoIt v1.4 - 20th January, 1999
  2. ================================
  3.  
  4. (C)1999 Jonathan Bennett
  5. Email: jbennett@hidden.demon.co.uk
  6.  
  7. New releases at:
  8.     http://www.hidden.demon.co.uk/AutoIt/index.html
  9.  
  10. Email me, and I'll notify you of a new release.
  11.  
  12. -----------------------------------------------------------------------------
  13.  
  14. License
  15. ========
  16.  
  17. This program is EmailWare.  If you use it, drop me an email.
  18. The program may be freely distributed as long as the original package is intact.
  19.  
  20.  
  21.  
  22. Disclaimer
  23. ==========
  24.  
  25. This program is provided "As is".  Use it at your own risk.  
  26. There are no warranties, expressed or implied.
  27.  
  28.  
  29.  
  30. Introduction
  31. ============
  32.  
  33. AutoIt was primarily designed to assist in automatically installing software.
  34. Many software packages such as MS Office, IE4, Mcafee have their own automated
  35. installation routines - most applications don't.  AutoIt gets around this by 
  36. using a script file to perform window commands (waiting for, hiding, activating,
  37. etc.) and to send keystrokes to specific windows.  This allows AutoIt to perform
  38. the automatic installation of such software.  It can also be used to automate
  39. simple tasks.
  40.  
  41. Most keystrokes can be sent (i.e. not just alphanumerics, but characters like
  42. !"$%^&*()_-+=, using any language keyboard (reports please! :) ).
  43.  
  44. AutoIt was my attempt to write a replacement for the Microsoft utility
  45. "ScriptIt".  Here are the associated advantages and disadvanatages over ScriptIt.
  46.  
  47. Advantages
  48. ----------
  49.   - It's much smaller at 40Kb (600Kb smaller than ScriptIt).
  50.   - It will be updated if problems are found (or suggestions made)!!!!!
  51.   - The "Reveal" function is much better.
  52.   - Non-active as well as active windows can be waited for.
  53.   - Variable delays are possible (defined in milliseconds).
  54.   - The time in between keystrokes can be altered (in milliseconds).
  55.   - When running an application, a working directory can be specified.
  56.   - Can correctly activate windows under Win98/NT 5.0 (Use "WinActivate").
  57.   - Don't have to wait for a window in order to send keystrokes 
  58.     (e.g. send keys to the desktop).
  59.   - Free, free, free! :)
  60.  
  61. Disadvantages
  62. -------------
  63.   - None of the Wilson WinBatch commands are featured.
  64.     (But who used them anyway? :) )
  65.   - Due to the command names I've used, the scripts tend to be a little larger.
  66.  
  67.  
  68.  
  69. Conventions
  70. ===========
  71.  
  72. Parameters are shown in angled brackets, optional parameters are shown in
  73. square brackets.
  74.  
  75. e.g.
  76.   <cmd>,<parameter1>[,<parameter2>]
  77.  
  78. This is a command, followed by a comma and parameter1, optionally followed
  79. by a comma and parameter2. 
  80.  
  81. i.e. 
  82.   <cmd>,<parameter1>
  83.  
  84.   OR
  85.  
  86.   <cmd>,<parameter1>,<parameter2>
  87.  
  88.  
  89.  
  90. Command Line Syntax
  91. ===================
  92.  
  93. AutoIt is executed from the command line in the two following ways:
  94.  
  95.   AutoIt /reveal
  96.   AutoIt /reveal2
  97.  
  98.   OR
  99.  
  100.   AutoIt <filename of script file>
  101.  
  102.  
  103. Reveal Mode
  104. -----------
  105.  
  106. When launched with the "/reveal" command switch, the program pauses for five
  107. seconds and then displays information on the currently active window
  108. (five seconds should be enough time for you to switch to the window that you
  109. are interested in).  This allows you to see what information AutoIt can "see"
  110. on a window.  
  111.  
  112. The switch "/reveal2" is similar, but causes the text to be continuously
  113. updated.
  114.  
  115. N.B. As with ScriptIt, not all text on a window can be "Seen" - experiment!
  116.  
  117. Script Mode
  118. -----------
  119.  
  120. AutoIt will execute the script filename given on the command line.  The file
  121. can have any extension (I usually use .ini files as scripts).
  122.  
  123.  
  124.  
  125. Script File Syntax
  126. ==================
  127.  
  128. ; Start of script
  129. ; Comments are indicated by a semi-colon
  130.  
  131. <Cmd>,<Cmd Parameters>
  132. <Cmd2>,<Cmd2 Parameters>
  133. <Cmd3>,<Cmd3 Parameters>
  134.  
  135. ; More comments, etc
  136. ; End of script
  137.  
  138. There may also be an optional [ADLIB] section at the end of the script.
  139. (see below)
  140.  
  141. Each line in the script can contain leading and trailing white spaces (space
  142. or tabs).  
  143.  
  144. i.e. 
  145.   "   Wait ,   Parameter1  ,  Parameter2     " 
  146.  
  147. will be evaluated as:
  148.  
  149.   "Wait,Parameter1,Parameter2"
  150.  
  151. When using the key "Send" command, you may wish to send spaces, in this case
  152. use "{SPACE}" to denote a space.
  153.  
  154. If a line contains a command that is not recognised, it will be treated as
  155. a comment.
  156.  
  157.  
  158.  
  159. Window Titles and Text
  160. ======================
  161.  
  162. A number of script commands have "Window Title" and "Window Text" as parameters.  
  163. "Window Title" is text that appears in the windows title bar.  
  164. "Window Text" is any other text on that window, e.g. text on buttons such as 
  165. "OK" and "Cancel".
  166.  
  167. Having "Window Text" allows you to distinguish between multiple windows that 
  168. have the same title.
  169.  
  170. Neither the title nor text needs to be completely specified.  
  171. I.e.  "Untitled - No" will match a window with the title "Untitled - Notepad".
  172.  
  173. Use the "/reveal" mode to see what text is present on a window.
  174.  
  175.  
  176.  
  177. Script Commands
  178. ===============
  179.  
  180. The following commands are currently recognised (commands are not case sensitive):
  181.  
  182. <Run>,<Program path and name>[*<Working directory>]
  183. ---------------------------------------------------
  184.  
  185.   Executes a given program and proceeds to the next line of the script.  
  186.   N.B. The program to run and the working directory are separated by a '*'.
  187.   The working directory is optional.
  188.  
  189.   e.g.  Run,notepad.exe*C:\WINDOWS
  190.         Run,C:\Program Files\Microsoft Office\Office\WinWord.exe
  191.  
  192.   The first command runs notepad and sets the working directory to "C:\WINDOWS".
  193.   The second command runs MS Word in the current directory.
  194.  
  195.   You can also run command interpreter commands line Echo, Copy, etc.
  196.   
  197.   e.g.  Run,COMMAND.COM /C Echo Hello > C:\Hello.txt
  198.  
  199.   Creates a file called C:\Hello.txt containing the word "Hello".
  200.  
  201. <RunWait>,<Program path and name>[*<Working directory>]
  202. -------------------------------------------------------
  203.  
  204.   Executes a given program and waits for it to close before proceeded to the next
  205.   line of the script.
  206.  
  207.   e.g.  RunWait,Notepad.exe
  208.  
  209.  
  210. <Send>,<Series of key presses>
  211. ------------------------------
  212.  
  213.   Sends a set of keystrokes to the currently active window.
  214.   (The syntax of these keystrokes can be found in the following section).
  215.  
  216.   e.g  Send,This is a line of text#{ENTER}
  217.  
  218.  
  219. WinWait,<Window Title>[,<Window Text>]
  220. --------------------------------------
  221.  
  222.   Stops script execution until the specified window exists.  The window does not
  223.   need be active.
  224.  
  225.   e.g.  WinWait,Untitled - Notepad
  226.  
  227.  
  228. WinWaitClose,<Window Title>[,<Window Text>]
  229. -------------------------------------------
  230.  
  231.   Stops script execution until the specified window ceases to exist.
  232.  
  233.   e.g.  WinWaitClose,Untitled - Notepad
  234.  
  235.  
  236. WinWaitActive,<Window Title>[,<Window Text>]
  237. --------------------------------------------
  238.  
  239.   Stops script execution until the specified window to exists and is active.
  240.  
  241.  
  242. WinHide,<Window Title>[,<Window Text>]
  243. WinRestore,<Window Title>[,<Window Text>]
  244. WinMinimize,<Window Title>[,<Window Text>]
  245. WinMaximize,<Window Title>[,<Window Text>]
  246. WinActivate,<Window Title>[,<Window Text>]
  247. WinClose,<Window Title>[,<Window Text>]
  248. ------------------------------------------
  249.  
  250.   Stops script execution until the specified window exists and then performs
  251.   the relevant command, i.e. minimising, hiding, restoring, etc.
  252.   >> N.B. WinActivate will bring a window to the top even under Win98/NT5. <<
  253.  
  254.  
  255. Sleep,<milliseconds>
  256. --------------------
  257.  
  258.   Halts execution of the script for the given number of milliseconds.  Max is 32767.    
  259.  
  260.  
  261. SetKeyDelay,<milliseconds>
  262. --------------------------
  263.  
  264.   Changes the delay between keystrokes in milliseconds.  Max is 32767.
  265.   Default is 10ms.
  266.  
  267.  
  268.  
  269. "Send" Command Syntax
  270. =====================
  271.  
  272. The "Send" command syntax is similar to that of ScriptIt and the Visual Basic
  273. "SendKeys" command.  Characters are sent as written with the exception of the
  274. following characters:
  275.  
  276. '!'
  277.   This tells AutoIt to send an ALT keystroke, therefore "Send,This is text!a"
  278.   would send the keys "This is text" and then press "ALT+a".  
  279.  
  280.   N.B. Some programs are very choosy about capital letters and ALT keys, 
  281.   i.e. "!A" is different to "!a".  The first says ALT+SHIFT+A, the second is ALT+a.
  282.   If in doubt, use lowercase!
  283.  
  284. '+'
  285.   This tells AutoIt to send a SHIFT keystroke, therefore "Send,Hell+o" would send
  286.   the text "HellO".  "Send,!+a" would send "ALT+SHIFT+a".
  287.  
  288. '^'
  289.   This tells AutoIt to send a CONTROL keystroke, therefore "Send,^!a" would send 
  290.   "CTRL+ALT+a".
  291.  
  292. '#'
  293.   The hash is used as a key delimiter to make a line easier to read.  
  294.   i.e. "Send, H#e#l#l#o" is the same as "Send,Hello".
  295.  
  296.  
  297. Certain special keys can be sent and should be enclosed in braces:
  298.  
  299. Send Command    Resulting Keystroke
  300. ------------    -------------------
  301. {#}             #
  302. {!}             !
  303. {^}             ^
  304. {+}             +
  305. {{}             {
  306. {}}             }
  307. {SPACE}         Space
  308. {ENTER}         The return/enter key is sent
  309. {ALT}           Alt key
  310. {BACKSPACE}     Backspace
  311. {BS}            Backspace
  312. {DEL}           Delete
  313. {DELETE}        Delete
  314. {DOWN}          Cursor down
  315. {END}           End
  316. {ESC}           Escape
  317. {ESCAPE}        Escape
  318. {F1}-{F12}      Function keys
  319. {HOME}          Home
  320. {INS}           Insert
  321. {INSERT}        Insert
  322. {LEFT}          Cursor left
  323. {PGDN}          Page down
  324. {PGUP}          Page up
  325. {RIGHT}         Cursor right
  326. {TAB}           Tab
  327. {UP}            Cursor up
  328.  
  329.  
  330. Keys can also be repeated, e.g.
  331.   {DEL 4}    Presses the DEL key 4 times
  332.   {S 30}     Sends 30 'S' characters
  333.   +{TAB 4}   Presses SHIFT+TAB 4 times
  334.  
  335.  
  336.  
  337. [ADLIB] Section
  338. ===============
  339.  
  340. The [ADLIB] section is optional, and if present should be placed at the
  341. end of the script file.  The ADLIB section is designed to cope with unexpected
  342. conditions.  The ADLIB section consists of single line commands that check if a
  343. window is active and if so, send keys to it.
  344. The ADLIB section must start with the line "[ADLIB]".
  345.  
  346. The format of the a line in the ADLIB section is:
  347.  
  348.     <Window Title>,<Window Text>,<Keys to Send>
  349.  
  350. e.g.
  351.     Run,Notepad.exe
  352.     WinWaitActive,Untitled - Notepad
  353.     Send,12345678#!{F4}
  354.     WinWaitClose,Untitled - Notepad
  355.  
  356.     [ADLIB]
  357.     Notepad,save the changes?,!n
  358.  
  359. Without the ADLIB section, this script would never end as Notepad would never
  360. close until someone responded to the message "Do you want to save the changes?".
  361.  
  362. ADLIB commands must contain a window title and some text on the window.
  363. If there is no text on the window, or if you don't want to specify any, then you must
  364. use two commas.
  365.  
  366. e.g.
  367.     Run,Notepad.exe
  368.     WinWaitActive,Untitled - Notepad
  369.     Send,12345678#!{F4}
  370.     WinWaitClose,Untitled - Notepad
  371.  
  372.     [ADLIB]
  373.     Notepad,,!n
  374.  
  375.  
  376. Examples
  377. ========
  378.  
  379. See the "Examples" directory that accompanies this archive for some examples.
  380.  
  381.  
  382.  
  383. Thanks to
  384. =========
  385.  - The people from Computacenter who tested it.
  386.  - Steve Hurcombe for the "/reveal2" suggestion.
  387.