DirectScreen Technology


SUBMITTED BY: rilp44

DATE: Dec. 5, 2015, 1:54 a.m.

FORMAT: Text only

SIZE: 8.0 kB

HITS: 2198

  1. __TOC__
  2. == DirectScreen Technology [[Image:IMacros-icon.png|iMacros Browser]] [[Image:Ie-icon.png|IE Plug-in]]==
  3. (Related example macros: Demo-FileUpload, Demo-Flash, Demo-Winclick)
  4. 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.
  5. 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.
  6. [[Image:flash_page.png|left|thumb|300px|Flash applet simulating a calculator]]
  7. [[Image:Example-javascript-ds.png|center|thumb|300px|Example of a tricky (non-standard) Javascript overlay dialog that is best automated with DirectScreen. ]]
  8. == Recording DirectScreen commands [[Image:IMacros-icon.png|iMacros Browser]] [[Image:Ie-icon.png|IE Plug-in]]==
  9. When working with non-HTML technologies like Flash or Java (Example: [http://demo.imacros.net/Automate/FlashDemo 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:
  10. [[Image:Select_click_mode_DS.png|right|thumb|150px|Click Mode Selection]]
  11. 1. Press the "Click Mode" button
  12. 2. Select "Use Direct Screen Commands ..." from the settings pop-up
  13. 3. Use the applet
  14. 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.
  15. ==How to define coordinates==
  16. There are several methods to define coordinates for a DirectScreen command:
  17. 1. Absolute value:
  18. DS CMD=MOVETO X=455 Y=224
  19. 2. Center of HTML element, as defined by the preceding [[TAG]] command. This is especially useful for use with AJAX elements.
  20. DS CMD=MOVETO X={{!<nowiki>TAGX}}</nowiki> <nowiki>Y={{!TAGY}} </nowiki>
  21. 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.
  22. DS CMD=MOVETO <nowiki>X={{!IMAGEX}} Y={{!IMAGEY}}</nowiki>
  23. ==Why are there so many WAIT statements?==
  24. [[Image:DS_with_WAIT_statements.png|right|thumb|300px|DirectScreen Default Settings]]
  25. If you choose the DirectScreen default settings, 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.
  26. 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 <nowiki>{{IMAGESEARCH}}</nowiki> command, which scans the browser screen until the specified image (e. g. image of a button or text) appears.
  27. ==Entering Text==
  28. When using the DS click mode, DS also records text input by using the "DS CMD=KEY" command. You can use the <nowiki>{BACKSPACE}</nowiki> command to overwrite existing text. Here's an example:
  29. <nowiki>
  30. VERSION BUILD=10.4.28.1074
  31. TAB T=1
  32. TAB CLOSEALLOTHERS
  33. URL GOTO=http://www.amazon.de/
  34. SIZE X=845 Y=855
  35. WAIT SECONDS=0.094
  36. DS CMD=MOVETO X=286 Y=62 CONTENT=
  37. WAIT SECONDS=0.421
  38. DS CMD=LDOWN X=286 Y=63 CONTENT=
  39. WAIT SECONDS=0.39
  40. DS CMD=LUP X=286 Y=63 CONTENT=
  41. WAIT SECONDS=1.016
  42. DS CMD=KEY CONTENT=Kindle
  43. WAIT SECONDS=0.968
  44. WAIT SECONDS=0.125
  45. DS CMD=MOVETO X=587 Y=71 CONTENT=
  46. WAIT SECONDS=1.0
  47. DS CMD=KEY CONTENT={ENTER}
  48. WAIT SECONDS=0.109
  49. DS CMD=MOVETO X=66 Y=234 CONTENT=
  50. </nowiki>
  51. == SYNTAX ==
  52. DS CMD=command X=coordinate Y=coordinate [CONTENT=some_content]
  53. == Parameters ==
  54. * CMD
  55. *: The command/action to be performed
  56. * commands:
  57. ** CLICK
  58. **: behaves like (old) [[WINCLICK]]. Technically this is a combination of the MOVE, LDOWN, LUP and KEY commands.
  59. ** LDBLCLK
  60. **: Simulate left double click (at position). When recording with the "Record all DirectScreen commands" option enabled, the correct sequence of commands is recorded for the LDBLCKL to work on playback. When using "Record only mouse clicks," LDBLCLK is not recorded, but you can manually add the following sequence of commands for a double-click: LDOWN, LUP, LDBLCLK, LUP.
  61. ** LDOWN
  62. **: Simulate left mouse button being pressed (at position)
  63. ** LUP
  64. **: Simulate left mouse button being released (at position)
  65. ** MOVETO
  66. **: Moves pointer (to position)
  67. ** MDOWN
  68. **: Simulate middle mouse button being pressed (at position)
  69. ** MUP
  70. **: Simulate middle mouse button being released (at position)
  71. ** MDBLCLK
  72. **: Simulate middle double click (at position)
  73. ** RDOWN
  74. **: Simulate right mouse button being pressed (at position)
  75. ** RUP
  76. **: Simulate right mouse button being released (at position)
  77. ** RDBLCLK
  78. **: Simulate right double click (at position)
  79. ** SCREENSHOT '''(deprecated in iMacros 7!)'''
  80. **: 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.
  81. ** KEY
  82. **: Enter text, perform key sequence. Specify the keys/text to enter in the CONTENT parameter.
  83. **: Special commands for the KEY command:
  84. **: <nowiki>{BACKSPACE}</nowiki> Deletes one character. Use several BACKSPACE commands to delete more characters or CONTENT=#ERASEALL# to clear the whole field.
  85. **: <nowiki>{ENTER}</nowiki> "Press" the Enter key.
  86. <!--
  87. **: <nowiki>{INSERT}</nowiki> "Press" the Insert key.
  88. **: <nowiki>{DELETE}</nowiki> "Press" the Delete key.
  89. **: <nowiki>{HOME}</nowiki> "Press" the Home key.
  90. **: <nowiki>{END}</nowiki> "Press" the end key.
  91. **: <nowiki>{PAGEUP}</nowiki> "Press" the PageUp key.
  92. **: <nowiki>{PAGEDOWN}</nowiki> "Press" the PageDown key.
  93. **: <nowiki>{LEFT}</nowiki> "Press" the Left Arrow key.
  94. **: <nowiki>{RIGHT}</nowiki> "Press" the Right Arrow key.
  95. **: <nowiki>{UP}</nowiki> "Press" the Up Arrow key.
  96. **: <nowiki>{DOWN}</nowiki> "Press" the Down Arrow key.
  97. **: <nowiki>---</nowiki>
  98. -->
  99. **: '''Note:''' The modifier keys {SHIFT}, {CTRL}, and {ALT} are currently not supported, nor is {TAB}, {ESC} and others not listed here.
  100. * CONTENT
  101. *: Specifies the content to send to the selected element. Specify CONTENT=#ERASEALL# to clear the entire field.
  102. Example:
  103. DS CMD=CLICK X=411 Y=434 CONTENT=#ERASEALL#
  104. DS CMD=KEY X=411 Y=434 CONTENT=#ERASEALL#
  105. == See Also ==
  106. * [http://forum.iopus.com/viewtopic.php?f=6&t=301 How to use DirectScreen with web page elements below the fold.]
  107. * [[FAQ#Q:_What_factors_can_cause_the_image_recognition_or_DirectScreen_to_fail_on_one_machine_whereas_it_is_working_on_others.3F|What factors can cause the image recognition or DirectScreen to fail on one machine whereas it is working on others?]]
  108. * [http://forum.iopus.com/viewtopic.php?t=9543 Which technologies are supported in tray/silent mode]
  109. * [http://forum.iopus.com/viewtopic.php?f=11&t=19209 Workaround for lack of DS mouse commands in iMacros for Firefox]

comments powered by Disqus