Description of the add-on to StDemo Player ========================================== The feature described below is not included in the shareware version of StDemo Player. If you are interested in this add-on, you may order it when you register StDemo Player. Total price of StDemo Pro is $60 (single licence). Professional version doesn't impose limits on keyboard/mouse simulation. In "standard" version some keys are impossible to simulate (for example, pressing Alt alone, i.e. not as a modifier to some other key) and mouse simulation is limited to the client area of a window only. There are some other cases when mouse simulation wouldn't work, drag-and-drop from File Manager, for instance. Professional version allows any simulation. StDemo Pro allows to simulate all keyboard and mouse events using Windows journal capabilities. The command to use is: :" contains the list of codes which describe desired actions. Keyboard events are simulated by sending one or more keystrokes to the active window as if they had been entered at the keyboard. Each key is represented by one or more characters. To specify a single keyboard character, use the character itself. For example, to represent the letter a, use "a" for . If you want to represent more than one character, append each additional character to the one preceding it. To represent the letters a, B, and c, use "aBc" for . The plus sign (+), caret (^), percent sign (%), tilde (~), braces { }, and parentheses ( ) have special meanings inside the . To specify one of these characters, enclose it inside braces. For example, to specify the plus sign, use {+}. To send brace characters, use {{} and {}}. To specify characters that aren't displayed when you press a key (such as Enter or Tab) and keys that represent actions rather than characters, use the codes shown below: Key Code --- ---- Backspace {BACKSPACE} or {BS} or {BKSP} Break {BREAK} Caps Lock {CAPSLOCK} Clear {CLEAR} Del {DELETE} or {DEL} Down Arrow {DOWN} End {END} Enter {ENTER} or ~ Esc {ESCAPE} or {ESC} Help {HELP} Home {HOME} Ins {INSERT} Left Arrow {LEFT} Num Lock {NUMLOCK} Page Down {PGDN} Page Up {PGUP} Print Screen {PRTSC} Right Arrow {RIGHT} Scroll Lock {SCROLLOCK} Space {Space} or {Blank} Tab {TAB} Up Arrow {UP} F1 {F1} F2 {F2} F3 {F3} F4 {F4} F5 {F5} F6 {F6} F7 {F7} F8 {F8} F9 {F9} F10 {F10} F11 {F11} F12 {F12} F13 {F13} F14 {F14} F15 {F15} F16 {F16} To specify keys combined with any combination of Shift, Ctrl, and Alt keys, precede the regular key code with one or more of the following codes: Key Code --- ---- Shift + Control ^ Alt % To specify that Shift, Ctrl, and/or Alt should be held down while several other keys are pressed, enclose the keys' code in parentheses. For example, to have the Shift key held down while word "code" is being typed, use "+(code)". It has the same effect as using "CODE". Pay attention to the case of the letters when using + modifier. It actually reverses the case. For example, +(CODE) will produce "code". To have two modifiers to be applied to the keystroke, precede the keystroke with both, i.e. "^+{End}" means Ctrl-Shift-End. To simulate pressing Shift, Alt or Ctrl alone use the form %(), +() or ^(). To specify repeating keys, use the form {key number}; you must put a space between key and number. For example, {LEFT 4} means press the Left Arrow key 4 times; {SPACE 10} means press space 10 times; {a 5} means press "a" 5 times. Mouse events are simulated by using one or more special codes in the . Action Code ------ ---- LeftButtonClick {Lclick} RightButtonClick {Rclick} MiddleButtonClick {Mclick} MoveMouse {Move} DragWithLeftButton {LDrag} DragWithRightButton {RDrag} DragWithMiddleButton {MDrag} "Drag" means moving the mouse with the button held pressed. Double-click might be coded as {LClick 2}. Make sure that the current delay applied between events is small enough. Mouse move and drag commands have "parameters" coded as numbers separated by space or "|" after the code inside the braces. First two represent the X and Y coordinates of the point where mouse movement ends. (It starts from the current cursor position). The third parameter (optional, 1 by default) shows in how many steps this movement will be executed, i.e. how many "jumps" mouse cursor will make. The following example shows how to draw a square in the Paintbrush: {Move 200|200}{LDrag 300|200|2}{LDrag 300|300|2}{LDrag 200|300|2}{LDrag 200|200|2} Coordinates may be expressed as "relative" if they are preceded with "+" or "-" sign. "*" represents the current coordinate. The previous example might be modified as follows using relative coordinates: {Move 200|200}{LDrag +100|*|2}{LDrag *|+100|2}{LDrag -100|*|2}{LDrag *|-100|2} Alt/Ctrl/Shift modifiers may be used with the mouse simulation codes in the same way as with the keyboard simulation codes. When using coordinates, it is very important to understand and use the proper scheme of coordinate origin and scaling. Selecting appropriate coordinates origin allows to make your mouse simulation commands invariant to the window's position on a desktop. Selecting appropriate coordinates scaling allows to make your mouse simulation commands invariant to the window's size and/or the resolution of the screen. There are some special codes to define origin and scaling. Action Code ------ ---- Set coordinate origin {Origin} Set coordinates scaling {Virtsize} The following codes represent all possible cases of using coordinates origin: {Origin Desktop} The coordinates origin (0,0) is in the upper left corner of the desktop. {Origin Window Active} The coordinates origin (0,0) is in the upper left corner of the window area of the currently active window. {Origin Window Focus} The coordinates origin (0,0) is in the upper left corner of the window area of the window which currently owns focus. {Origin Window Class|} The coordinates origin (0,0) is in the upper left corner of the window area of the window which classname matches given string. {Origin Window Caption|} The coordinates origin (0,0) is in the upper left corner of the window area of the window which caption matches given string. {Origin Client Active} {Origin Client Focus} {Origin Client Class|} {Origin Client Caption|} All these cases are the same as for "Window" but the origin starts in the upper left corner of the client area. Coordinates scaling might be defined using the following form: {VirtSize X|Y} where X and Y are numbers representing the virtual size of the area chosen by {Origin} command. For example, if origin refers to the desktop - virtual size defines the size of the screen, if origin is "window" - virtual size refers to the size of the window area, if origin is "Client" - virtual size refers to the size of a client area. If virtual size defined as {Virtsize *|*} then all coordinates are treated as absolute. This is the default setting for VirtSize. Otherwise coordinates are scaled to the correspondent desktop/window/client virtual size. For example, to divide the paint area of the PaintBrush into four equal quarters, the following sequence might be used: :"{Origin Client Class|pbPaint}{VirtSize 1000 1000}{Move 0 500}{LDrag 1000 500}{Move 500 0}{LDrag 500 1000} NOTE ---- {Origin} and {Virtsize} codes have LOCAL scope -- they affect only commands in the same :" line where they were coded. If subsequent :" commands don't have {Origin}/{VirtSize}, GLOBAL values for them will be used. These global values are set with :O and :S commands. (Refer to the readme.txt). Examples: :OSWV :S1000|1000 .... equal to :"{Origin Desktop}{VirtSize 1000 1000}....... :OACA .... equal to :"{Origin Client Active}{VirtSize *|*}....... :OFW :S100|100 .... equal to :"{Origin Window Focus}{VirtSize 100|100}....... The following example demonstrates using of the :" command... ------------------cut here------------------------- :C11 :I11 :=100 :(pbrush.exe :#S Let's draw some figures in Paintbrush # :"{Origin Client Class|pbPaint}{VirtSize 100 100}{Move 0 50}{LDrag 100 * 10}{Move 50 0}{LDrag * 100 10} // select circle tool :"{Origin Client Class|pbTool}{VirtSize 4 18}{Move 1 15}{LClick} // Draw several ellipses in different colors :"{Origin Client Class|pbColor}{VirtSize 32 4}{Move 9 1}{LClick} :"{Origin Client Class|pbPaint}{VirtSize 100 100}{Move 40 40}{LDrag 60 60} :"{Origin Client Class|pbColor}{VirtSize 32 4}{Move 11 1}{LClick} :"{Origin Client Class|pbPaint}{VirtSize 100 100}{Move 30 30}{LDrag 70 70 4} :"{Origin Client Class|pbColor}{VirtSize 32 4}{Move 13 3}{LClick} :"{Origin Client Class|pbPaint}{VirtSize 100 100}{Move 20 20}{LDrag 80 80 100} :#S Closing paintbrush # :"%fxn // LcalcDemo :#S The following is the "calc" sample from script.txt expressed with :" notation. .S Note using the :O and :S commands to set GLOBAL Origin and VirtSize. # :LcalcDemo :(calc.exe :S324|283 :OFC // View->Standard :"%vt // Clear :#S I'm going to move the cursor to the 'CLEAR' button - and click. # :"{Move 0|0}{Move 38|66|30}{LClick} // click 2 :#S Now I'm going to move the cursor to the '2' button - and click. # :"{Move 135|196|30}{LClick} // click * :#S Now I'll move to the '*' button - and click. # :"{Move 242|152|30}{LClick} // click 3 :#S And here we go to the '3' button - and click. # :"{Move 189|196|30}{LClick} // click = :#S Now I'm going to click on '=' and, truly, I'm expecting to get.... # :"{Move 295|240|30}{LClick} :#S Don't tell me that the result is not equal to six, please! # :"%E{Left}{Down 5}{Enter} :#S Calc must be closed now. .S That's all. # ------------------cut here-------------------------