home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD 45 / SuperCD45.iso / talleres / vayuda / helpscrn / script / README.TXT < prev    next >
Text File  |  1999-12-23  |  15KB  |  423 lines

  1. Readme file for script.exe
  2.  
  3. That's right, yet another Windows script program.  The big difference is that this one is free
  4. _and_ you get the source, but wait if you order now we'll throw in the Ginsu knives, the apple
  5. peeler and the four-in-one kitchen wonder.  That also means that if you want to change it you
  6. can, but don't come back to the author with your 300 line hack wanting him to fix "his" program.
  7. You break it, you own it.  I kept script simple because I had simple needs.  If your needs are
  8. more complex you probably want to look elsewhere, there are several excellent scripting programs
  9. available which will undoubtedly fit the bill.
  10.  
  11. Script is a small program which allows automation of Windows (95/NT) tasks through the use of files
  12. containing command lists.  It is, with the exception of the actual scripts, self contained.  That means
  13. no external dll's, no registry entries, no ini files.  To install script, just copy script.exe to an
  14. appropriate directory.  If the scripts are in a different directory than the executable then the full
  15. path to them will need to be specified.
  16.  
  17. Script was written in (gasp) C using Microsoft Visual C/C++ 4.2.á I don't have any other compiler so
  18. if you make changes and can't get it to compile correctly using the compiler you got from Burger King
  19. with the kiddie meal, you are on your own.á If you are successful and want to send me the necessary steps,
  20. (readme's, makefiles, etc.) to include in the package I will be glad to, however, your name will be
  21. prominently displayed and all questions will be forwarded to you.
  22.  
  23. The input to script is a text file with a default extension of .scr.  Commands are contained one
  24. on each line and blank lines and lines whose first nonblank character is a ; are ignored.  Lines
  25. which begin with a : are labels and may not contain commands.  Commands are not case sensitive: Start,
  26. start and sTaRt are equivalent.
  27.  
  28. The commands available are:
  29.  
  30.     start
  31.  
  32.     description:
  33.     
  34.         start is used to run a program.  The full path name and the file extension
  35.         are required.  Command line options may be included after the executable.
  36.         Quotes are not necessary and the backslash character _must_ be escaped (i.e. \\).
  37.         start may be followed optionally by min, norm or max which will cause the window to
  38.         open minimized (an icon), normally, or maximized.  The default is max.  A startup directory
  39.         may be optionally included as well.  If the startup directory is appended then
  40.         min, norm, or max _must_ be specified (no place holders).
  41.         
  42.     syntax:
  43.  
  44.         start,program[,min|max][,startup directory]
  45.  
  46.     example:
  47.  
  48.         start,c:\\winnt\\notepad.exe
  49.         start,c:\\winnt\\system32\\command.com /c h:\\temp\\test.bat,min
  50.         start,c:\\winnt\\welcome.exe,max,c:\\winnt
  51.  
  52.  
  53.     wait
  54.  
  55.     description:
  56.  
  57.         wait will cause the program to loop waiting for a window whose title text matches
  58.         the text string which follows the wait command.  An optional timeout value may be
  59.         specified (in .1 second increments), if this value is not given then the default
  60.         value is "wait forever".  If a timeout occurs the internal error flag is set to true
  61.         and onerror can be used to branch to a handler.  Special characters contained
  62.         in the text string must be escaped (, \ % ^ ? *).  The string _is_ case sensitive
  63.         and must match _exactly_.  The exception to this is the use of the two wild card
  64.         characters: ? and *.  The question mark is a single character wild card and will match
  65.         any character appearing in the same position, i.e. a?b?c will match a1b2c or aabbc, but
  66.         not abc or a11b11c.  The asterisk is an n character wild card and will match 0 or more
  67.         characters appearing in the same position, i.e. a*b*c* will match abc, alphabet soup can,
  68.         or aabbc.  Note: two windows with exactly the same title text (i.e.
  69.         script.c - Notepad) are undifferentiable and the command will act on the first
  70.         one encountered in the task list which may not produce the expected results.  A clever
  71.         programmer will realize that wait/onerror can also be used to test if a program
  72.         is already running.
  73.  
  74.     syntax:
  75.  
  76.         wait,window title[,timeout]
  77.  
  78.     example:
  79.  
  80.         wait,readme - Notepad
  81.         wait,Microsoft Word - Document1,10000
  82.  
  83.  
  84.     send
  85.  
  86.     description:
  87.  
  88.         send is used to force characters to a window whose title text matches the
  89.         text string which follows the send command.    The string _is_ case sensitive
  90.         and must match _exactly_.  The exception to this is the use of the two wild card
  91.         characters: ? and *.  The question mark is a single character wild card and will match
  92.         any character appearing in the same position, i.e. a?b?c will match a1b2c or aabbc, but
  93.         not abc or a11b11c.  The asterisk is an n character wild card and will match 0 or more
  94.         characters appearing in the same position, i.e. a*b*c will match abc, alphabet soup can,
  95.         or aabbc.   The string sent is the last parameter on the line.  Special characters
  96.         contained in the text string must be escaped (, \ % ^ ? * $ #).  The % and ^ characters have
  97.         special meaning: unescaped the % will cause an Alt-key sequence to be sent and the ^ will
  98.         cause the character immediately following to be converted to a control character.
  99.         The unescaped $ character indicates that the two characters following it are a function key
  100.         number.  The two characters _must_ be numeric in the range of 1-12 inclusive.  The
  101.         unescaped # character indicates that the two characters following it are a hexidecimal
  102.         representation.  Legal values are 0-9, A-F, and a-f.  (Yeah, I know, it's awkward).
  103.         Additional escape sequences are defined: \n will cause a return to be sent
  104.         and \t will send a tab.  ? and * must be escaped even though they have no special meaning 
  105.         here.  Note: two windows with exactly the same title text (i.e.
  106.         script.c - Notepad) are undifferentiable and the command will act on the first
  107.         one encountered in the task list which may not produce the expected results.
  108.  
  109.     syntax:
  110.  
  111.         send,window title,text string
  112.  
  113.     example:
  114.  
  115.         send,readme - Notepad,This is a line\nand this is the second line
  116.  
  117.  
  118.     delay
  119.  
  120.     description:
  121.  
  122.         delay causes the script to pause for the number of .1 second increments
  123.         specified after the delay command.
  124.  
  125.     syntax:
  126.  
  127.         delay,number
  128.  
  129.     example:
  130.  
  131.         delay,500
  132.  
  133.  
  134.     msgbox
  135.  
  136.     description:
  137.  
  138.         Display text in a message box.  Use $syserr for the text string to print the text
  139.         of the last system error.  Default display mode is MB_OK | MB_SYSTEMMODAL.
  140.         Legitimate values are any combination of the following (the numeric sum must be
  141.         used not the symbol).
  142.             MB_OK                       0
  143.             MB_OKCANCEL                 1
  144.             MB_ABORTRETRYIGNORE         2
  145.             MB_YESNOCANCEL              3
  146.             MB_YESNO                    4
  147.             MB_RETRYCANCEL              5
  148.  
  149.             MB_ICONHAND                 16
  150.             MB_ICONQUESTION             32
  151.             MB_ICONEXCLAMATION          48
  152.             MB_ICONASTERISK             64
  153.  
  154.             MB_USERICON                 128
  155.             MB_ICONWARNING              MB_ICONEXCLAMATION
  156.             MB_ICONERROR                MB_ICONHAND
  157.  
  158.             MB_ICONINFORMATION          MB_ICONASTERISK
  159.             MB_ICONSTOP                 MB_ICONHAND
  160.  
  161.             MB_DEFBUTTON1               0
  162.             MB_DEFBUTTON2               256
  163.             MB_DEFBUTTON3               512
  164.             MB_DEFBUTTON4               768
  165.  
  166.             MB_APPLMODAL                0
  167.             MB_SYSTEMMODAL              4096
  168.             MB_TASKMODAL                8192
  169.             MB_HELP                     16384 // Help Button
  170.  
  171.             MB_NOFOCUS                  32768
  172.             MB_SETFOREGROUND            65536
  173.             MB_DEFAULT_DESKTOP_ONLY     131072
  174.  
  175.             MB_TOPMOST                  262144
  176.             MB_RIGHT                    524288
  177.             MB_RTLREADING               1048576
  178.             MB_SERVICE_NOTIFICATION     2097152
  179.  
  180.  
  181.     syntax:
  182.  
  183.         msgbox,text string[,display mode]
  184.  
  185.     example:
  186.  
  187.         msgbox,this is a test,3
  188.         ; this creates a message box containing "this is a test" with three buttons, YES, NO, and CANCEL
  189.  
  190.  
  191.     onerror
  192.  
  193.     descripton:
  194.  
  195.         Onerror allows conditional branching based on the results of the last start or wait
  196.         command.  Control is transferred to the label name contained in the onerror line.
  197.         Labels can be before or after the current line.
  198.  
  199.     syntax:
  200.  
  201.         onerror,label
  202.  
  203.     example:
  204.  
  205.         onerror,exit
  206.         .
  207.         .
  208.         .
  209.         :exit
  210.  
  211.  
  212.     goto
  213.  
  214.     description:
  215.  
  216.         goto allows unconditional branching.  Control is transferred to the label name
  217.         contained in the goto line.  Labels can be be before or after the current line.
  218.  
  219.     syntax:
  220.  
  221.         goto,label
  222.  
  223.     example:
  224.  
  225.         goto,exit
  226.         .
  227.         .
  228.         .
  229.         :exit   
  230.  
  231.  
  232.     while
  233.  
  234.     description:
  235.  
  236.         while waits for a window to close.  The text of the window must match the text
  237.         following the while command exactly.  The exception to this is the use of the two wild card
  238.         characters: ? and *.  The question mark is a single character wild card and will match
  239.         any character appearing in the same position, i.e. a?b?c will match a1b2c or aabbc, but
  240.         not abc or a11b11c.  The asterisk is an n character wild card and will match 0 or more
  241.         characters appearing in the same position, i.e. a*b*c will match abc, alphabet soup can,
  242.         or aabbc.  An optional timeout value may be specified (in .1 second increments), if
  243.         this value is not given then the default value is "wait forever".  If a timeout occurs
  244.         the internal error flag is set to true and onerror can be used to branch to a handler.
  245.  
  246.     syntax:
  247.  
  248.         while,window title[,timeout]
  249.  
  250.     example:
  251.  
  252.         while,Untitled - Notepad
  253.  
  254.  
  255.  
  256.     onexist
  257.  
  258.     descripton:
  259.  
  260.         onexist checks for the file specified immediately after the onexist command.  If the file
  261.         exists, control is transferred to the label whose name appears immediately after the filename.
  262.         Special characters (, \ % ^ ? * $ #) which appear in the filename string must be escaped.
  263.  
  264.     syntax:
  265.  
  266.         onexist,filename,label
  267.  
  268.     example:
  269.  
  270.         onexist,c:\\winnt\\notepad.exe,loop
  271.  
  272.  
  273.     onmsgrtn
  274.  
  275.     description:
  276.  
  277.         onmsgrtn is used to branch on the button pressed in a message box.  The legal values are:
  278.         ABORT, CANCEL, IGNORE, NO, OK, RETRY, and YES.
  279.  
  280.     syntax:
  281.  
  282.         onmsgrtn,button,label
  283.  
  284.     example:
  285.  
  286.         onmsgrtn,YES,exit
  287.  
  288.  
  289.     activate
  290.  
  291.     description:
  292.  
  293.         activate is used to bring an inactive window to the foreground
  294.  
  295.     syntax:
  296.  
  297.         activate,windows title
  298.  
  299.     example:
  300.  
  301.         activate,Untitled - Notepad
  302.  
  303.  
  304.     create
  305.  
  306.     description:
  307.  
  308.         create is used to create a file.  A full path may be specified, if it is not then it defaults to the
  309.         directory that script was started from.   This is useful when used in concert with the onexist keyword
  310.         to set a semaphore.  The file created will contain the current date and time.
  311.  
  312.     syntax:
  313.  
  314.         create,filename
  315.  
  316.     example:
  317.  
  318.         create,c:\\temp\\testfile
  319.  
  320.  
  321.     delete
  322.  
  323.     description:
  324.  
  325.         delete is used to delete a file.  A full path name may be specified, if it is not then it defaults to the
  326.         directory that script was start from.  Be careful, this command will delete any visible, read/write file
  327.         including system files and other valuable items.  This is useful when used in concert with the create and
  328.         onexist keywords to clear a semaphore.
  329.  
  330.     syntax:
  331.  
  332.         delete,filename
  333.  
  334.     example:
  335.  
  336.         delete,c:\\temp\\testfile
  337.  
  338. And now for something many have been waiting for... variables, well, sort of.
  339.  
  340.     set
  341.  
  342.     description:
  343.  
  344.         define and/or assign a value to a variable.  If the variable named does not exist then it is created and
  345.         the value is assigned to it.  If the variable does exist then it is assigned the value.  The only limit
  346.         on the number of variable which may be created is the amount of memory in the system.
  347.  
  348.     syntax:
  349.  
  350.         set,variable,value
  351.  
  352.     example:
  353.  
  354.         set,index,10
  355.  
  356.  
  357.     dec
  358.  
  359.     description:
  360.  
  361.         decrement a variable (subtract one).  If the variable named does not exist, an error is generated and
  362.         the interpreter exits.
  363.  
  364.     syntax:
  365.  
  366.         dec,variable
  367.  
  368.     example:
  369.  
  370.         dec,index
  371.  
  372.  
  373.     onzero
  374.  
  375.     description:
  376.  
  377.         check a variable for 0 and branch to the label if so.  If the variable is not zero, then continue to the
  378.         sequential line.  If the variable or the label do not exist then an error is generated and the interpreter
  379.         exits.  This is useful in concert with the set and dec keywords to create finite loops.
  380.  
  381.     syntax:
  382.  
  383.         onzero,variable,label
  384.  
  385.     example:
  386.  
  387.         onzero,index,loop
  388.  
  389.  
  390.         
  391.     
  392. Special character sequences:
  393.  
  394. %       Alt             Character following is alt-char
  395. ^       Control         Character following is a control character
  396. !    Shift        Character following is a shift character
  397. \n      newline         Equivalent to pressing the enter key
  398. \t      tab             Equivalent to pressing the tab key
  399. \e      escape          Equivalent to pressing the escape key
  400. \s      space           Equivalent to pressing the space key
  401. \u      pageup          Equivalent to pressing the Pg Up key
  402. \d      pagedown        Equivalent to pressing the Pg Dn key
  403. \h      home            Equivalent to pressing the Home key
  404. \o      end of line     Equivalent to pressing end (yeah, I know, but I ran out)
  405. \x        delete            Equivalent to pressing the Del key
  406. \,      comma           Commas must be escaped within literal strings to avoid being interpreted as separators
  407. \>      right           Equivalent to pressing the cursor right arrow
  408. \<      left            Equivalent to pressing the cursor left arrow
  409. \^      up              Equivalent to pressing the cursor up arrow
  410. \v      down            Equivalent to pressing the cursor down arrow
  411. \\      backslash       Backslashes must be escaped within literal strings to avoid being interpreted as escapes
  412. \?    question mark    Must be escaped within literal strings to avoid being interpreted as wildcards
  413. \*    asterisk    Must be escaped within literal strings to avoid being interpreted as wildcards
  414. \$    dollar sign    Must be escaped within literal strings to avoid being interpreted as a function key
  415. \#    pound sign    Must be escaped within literal strings to avoid being interpreted as a hex preamble
  416. \!      exclamation    Must be escaped within literal strings to avoid being interpreted as a shift shift
  417.  
  418.  
  419. Things to do:
  420.     improve error checking wrt use of attributes
  421.  
  422. Known Bugs:
  423.     Windows 95/98 dos box doesn't accept keystrokes