The renewal maintenance has officially ended for Progress iMacros effective November 30, 2023.
This Wiki site will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely, The Progress Team
Difference between revisions of "DirectScreen Technology"
Line 90: | Line 90: | ||
** RDBLCLK | ** RDBLCLK | ||
**: Simulate right double click (at position) | **: Simulate right double click (at position) | ||
− | ** SCREENSHOT | + | ** SCREENSHOT '''(deprecated in iMacros 7!)''' |
**: Take screenshot. This command is useful for screenshots of applets, where the normal screenshot feature does not work. The path for the screenshot is in the content attribute, e. g. ''DS CMD=SCREENSHOT X=380 Y=220 CONTENT=c:\myscreenshots\screen1.bmp''. The X/Y coordinates can be anywhere, but have to be inside the area from which you need to take the screenshot. So if you want take a screenshot of a [http://www.iopus.com/imacros/demo/v6/java/calc/ page with a Java applet,] the coordinates should be somewhere inside the Java applet, otherwise this area will remain black. Several screenshots can be combined in one with the SCREENSHOTINCLUDE command. | **: Take screenshot. This command is useful for screenshots of applets, where the normal screenshot feature does not work. The path for the screenshot is in the content attribute, e. g. ''DS CMD=SCREENSHOT X=380 Y=220 CONTENT=c:\myscreenshots\screen1.bmp''. The X/Y coordinates can be anywhere, but have to be inside the area from which you need to take the screenshot. So if you want take a screenshot of a [http://www.iopus.com/imacros/demo/v6/java/calc/ page with a Java applet,] the coordinates should be somewhere inside the Java applet, otherwise this area will remain black. Several screenshots can be combined in one with the SCREENSHOTINCLUDE command. | ||
** KEY | ** KEY |
Revision as of 12:16, 12 November 2010
DirectScreen Technology
(Related example macros: Demo-FileUpload, Demo-Flash, Demo-Winclick)
DirectScreen (DS) Technology is the ultimate solution if everything else fails! It simulates standard native mouse clicks within the browser window. It is activated during recording by clicking on the "Click Mode" button and selecting "Use DirectScreen Commands" from the dialog.
Typically DirectScreen Technology is used to automate web pages that contain non-HTML elements such as Java applets, Adobe Flash, Adobe Flex, Microsoft Silverlight or ActiveX controls. It also automates even the most complicated AJAX based website.
Demo movies (Flash tutorials):
- Automating AJAX Drag and Drop
- Web Automation with the Image Recognition Plugin (DirectScreen + Image Recognition)
Recording DirectScreen commands
When working with non-HTML technologies like Flash or Java (Example: calculator), iMacros can no longer work on the HTML code of the relevant page. To record a macro on a flash or Java applet, you must activate DirectScreen:
- Press the "Click Mode" button
- Select "Use Direct Screen Commands ..." from the settings pop-up
- Use the applet
You will find iMacros record the mouse and keyboard actions producing lots of DS and WAIT commands (depending on the complexity of the performed actions). The following section explains, why.
How to define coordinates
There are several methods to define coordinates for a DirectScreen command:
1. Absolute value:
DS CMD=MOVETO X=455 Y=224
2. Center of HTML element, as defined by the preceding TAG command. This is especially useful for use with AJAX elements.
DS CMD=MOVETO X={{!TAGX}} Y={{!TAGY}}
3. Center of image, as defined by the preceding IMAGESEARCH command. An image can be everything on the website, this is not limited to embedded HTML images.
DS CMD=MOVETO X={{!IMAGEX}} Y={{!IMAGEY}}
Why are there so many WAIT statements?
If you choose the DirectScreen settings default, iMacros records the actions at original speed, i.e. it does not only record the clicks, but also how long you wait between two actions (like "move", "press left mouse button", "release left mouse button", etc.). These time intervals are simulated by WAIT statements in the macro, which make iMacros, well, wait before performing the next command. This way, the applet has enough time to react to the actions taken.
If you notice that the applet is much faster than the users action, you can try to shorten the WAIT times by editing the macro. But note that the applet typically needs at least some time to respond. As an alternative to WAIT statements you can use the {{IMAGESEARCH}} command, which scans the browser screen until the specified image (e. g. image of a button or text) appears.
Entering Text
When using the DS click mode, DS also records text input by using the "DS CMD=KEY" command. You can use the {BACKSPACE} command to overwrite existing text. Here's an example:
VERSION BUILD=6000510 TAB T=1 TAB CLOSEALLOTHERS URL GOTO=http://amazon.com/ SIZE X=846 Y=612 DS CMD=MOVETO X=244 Y=123 WAIT SECONDS=0.01 DS CMD=LDOWN X=271 Y=79 WAIT SECONDS=0.01 DS CMD=LUP X=271 Y=79 WAIT SECONDS=0.01 DS CMD=KEY X=0 Y=0 CONTENT={BACKSPACE}my<SP>text
SYNTAX
DS CMD=command X=coordinate Y=coordinate [CONTENT=some_content]
Parameters
- CMD
- The command/action to be performed
- commands:
- CLICK
- behaves like (old) WINCLICK. Technically this is a combination of the MOVE, LDOWN, LUP and KEY commands.
- LDBLCLK
- Simulate left double click (at position)
- LDOWN
- Simulate left mouse button being pressed (at position)
- LUP
- Simulate left mouse button being released (at position)
- MOVETO
- Moves pointer (to position)
- MDOWN
- Simulate middle mouse button being pressed (at position)
- MUP
- Simulate middle mouse button being released (at position)
- MDBLCLK
- Simulate middle double click (at position)
- RDOWN
- Simulate right mouse button being pressed (at position)
- RUP
- Simulate right mouse button being released (at position)
- RDBLCLK
- Simulate right double click (at position)
- SCREENSHOT (deprecated in iMacros 7!)
- Take screenshot. This command is useful for screenshots of applets, where the normal screenshot feature does not work. The path for the screenshot is in the content attribute, e. g. DS CMD=SCREENSHOT X=380 Y=220 CONTENT=c:\myscreenshots\screen1.bmp. The X/Y coordinates can be anywhere, but have to be inside the area from which you need to take the screenshot. So if you want take a screenshot of a page with a Java applet, the coordinates should be somewhere inside the Java applet, otherwise this area will remain black. Several screenshots can be combined in one with the SCREENSHOTINCLUDE command.
- KEY
- Enter text, perform key sequence. Specify the keys/text to enter in the CONTENT parameter.
- Special commands for the KEY command:
- {BACKSPACE} Deletes one character. Use several BACKSPACE commands to delete more characters or CONTENT=#ERASEALL# to clear the whole field.
- {ENTER} "Press" the Enter key.
- {INSERT} "Press" the Insert key.
- {DELETE} "Press" the Delete key.
- {HOME} "Press" the Home key.
- {END} "Press" the end key.
- {PAGEUP} "Press" the PageUp key.
- {PAGEDOWN} "Press" the PageDown key.
- {LEFT} "Press" the Left Arrow key.
- {RIGHT} "Press" the Right Arrow key.
- {UP} "Press" the Up Arrow key.
- {DOWN} "Press" the Down Arrow key.
- ---
- Note: The modifier keys {SHIFT}, {CTRL}, and {ALT} are currently not supported, nor is {TAB}, {ESC} and others not listed here.
- CLICK
- CONTENT
- Specifies the content to send to the selected element. Specify CONTENT=#ERASEALL# to clear the entire field.
Example: DS CMD=CLICK X=411 Y=434 CONTENT=#ERASEALL# DS CMD=KEY X=411 Y=434 CONTENT=#ERASEALL#