FAQ


SUBMITTED BY: rilp44

DATE: Dec. 5, 2015, 2:04 a.m.

FORMAT: Text only

SIZE: 60.9 kB

HITS: 2281

  1. We separated the Frequently Asked Questions we got over the years into Getting started, Installation, Creating macros, Data extraction and Web testing related questions. Some topics in this section are duplicated topics that proved to be hard to find in the online help and the user manual, while others are solutions for a specific task.
  2. == Getting started ==
  3. === Q: What is the functional difference between Internet Explorer with iMacros turned on, and the iMacros browser? ===
  4. Technically speaking, the iMacros Browser is a "giant wrapper" around the Microsoft Internet Explorer low-level components, so ''iMacros uses '''exactly''' the same code to render a web page as Internet Explorer does''. There are no functional differences between the iMacros browser and the iMacros IE side bar.
  5. If you are undecided whether to use IE with iMacros or the iMacros Browser, we recommend to use the iMacros Browser. It is a dedicated application for web automation, data extraction and web testing. But note that you can fully [[iimInit|remote control]] the iMacros Browser, IE and Firefox. So you can always switch easily between the different browsers. To switch, you simply need to change the [[iimOpen]] parameter.
  6. '''Background information (for experts):''' The IExplore.exe of Internet Explorer is only a small application that is instantiated when Internet Explorer is loaded. This executable application uses Internet Explorer components to perform the navigation, history maintenance, favorites maintenance, HTML parsing and rendering, and so on, while it supplies the toolbar and frame for the stand-alone browser. IExplorer.exe directly hosts the Shdocvw.dll component as web browser. The Shdocvw.dll component is more frequently referred to as the WebBrowser Control. ''The iMacros Browser uses the same Shdocvw.dll component for its web browser.''
  7. [[iMacros for Firefox]] does '''not''' use any IE components. It runs directly inside the Mozilla Firefox web browser and automates the original Firefox web browser. Just like Internet Explorer and the iMacros Browser, Firefox can be remote controlled via the iMacros [[Web Scripting]] Interface.
  8. Please see [[FAQ#Q:_Can_a_macro_recorded_in_one_browser_be_played_in_a_different_browser.3F|this FAQ]] for additional information.
  9. === Q: The web page I am accessing requires Internet Explorer (IE). Is this a problem? ===
  10. No. iMacros is available as Internet Explorer add-in, so ''you can run all macros directly inside the real Microsoft Internet Explorer browser''.
  11. But you can also use the iMacros Browser because the '''iMacros browser is 100% Internet Explorer compatible'''. It comes with all Internet Explorer functions and Plugins, including Cookies, ActiveX Controls, AJAX, JavaScript, Silverlight and Adobe Flash.
  12. If you use iMacros for web testing automation, this means that ''you can run all IE related tests in the iMacros Browser, too''. The iMacros Browser will give you ''exactly'' the same rendering and error messages as Internet Explorer. We achieve this by using the original Internet Explorer DLLs from within the iMacros Browser.
  13. === Q: Are there conditional statements like if... then...else in the iMacros macro language? ===
  14. <small>([[conditionals|Short link to this FAQ]])</small>
  15. <nowiki>[</nowiki>'''Update:''' Starting with version 7.50, iMacros introduces [[EVAL]] that can be used to analyze a certain condition and abort the macro in case this condition is true or false.<nowiki>]</nowiki>
  16. The iMacros language itself is designed as a descriptive language ([[TAGs_and_HTML|similar to HTML]]) and does not contain conditional statements. We did not add such statements as we do not think that our customers should have to attend week-long seminars just to learn yet another proprietary scripting or programming language. In other words, iMacros commands refer to web page elements, so any programming logic must be put into a script that then uses iMacros to automate the website.
  17. So we created the ''very'' powerful Scripting Interface that allows you to '''use iMacros with every Windows Scripting or programming language''' on the planet. [[Sample Code|Examples]] are VBS, VB, VBA, VB.NET, Perl, Java, Foxpro, C, C++, C#, ASP, ASP.NET, PHP and many more. These languages are used by millions of computer users, are reliable and very well documented. We also added a command line interface for use with batch files and task scheduler.
  18. Basically what you do is:
  19. ReturnCode = iim1.iimPlay ("YourMacro1")
  20. if ReturnCode = 1 then
  21. 'Do something
  22. MsgBox "OK!"
  23. else
  24. 'Do something else
  25. ReturnCode = iim1.iimPlay ("YourMacro2")
  26. end if
  27. This example uses the [[Sample_Code#VBS_.28Visual_Basic_Scripting.29|Visual Basic]] syntax, but you can use [[Sample_Code|any programming or scripting language!]].
  28. More information about the iMacros language and its relation to HTML is available at [[TAGs_and_HTML]]. Examples on how to use the iMacros Scripting Interface are available in [[Sample_Code|sample code]] chapter.
  29. iMacros for Firefox also includes a [[iMacros_for_Firefox#Javascript_Scripting_Interface|built-in scripting interface]], but unlike the scripting interface provided with the Enterprise Edition, you are limited to using just Javascript and you cannot use it to create standalone scripts or programs (they only run inside the browser).
  30. Related FAQ: [[FAQ#Q: How can I do calculations in a macro?|How can I do calculations in a macro?]]
  31. === Q: How do I know whether I should use just a macro or if I need to also use a script for my task? ===
  32. Please see [[Macro or Script|this article]] for some tips on deciding whether you need to use pure iMacros or the iMacros Scripting Interface (i.e. iMacros together with a scripting or a programming language).
  33. == Installation ==
  34. [[Image:Customer Portal - Serial and Activation Key.png|thumb|500px|Licenses displayed on the My Products page in the [http://www.ipswitch.com/nmportal Customer Portal].]]
  35. === Q: Where do I find my Activation Key, License File, or Serial Number? ===
  36. Your iMacros serial number, activation key, and license file (required for [[Offline Activation|offline activations]] and player distribution) can be found by logging into the [http://www.ipswitch.com/nmportal Customer Portal] and clicking the My Products option. After activating iMacros, the serial number is also displayed in the Help - About box.
  37. === Q: Why can't I specify the destination folder when installing iMacros Standard/Enterprise Edition? ===
  38. '''Update:''' This has been fixed starting with iMacros 10.4 so that the installation location can now be specified when running the setup wizard.
  39. Due to the close dependency that iMacros has with Internet Explorer, and because of changes to recent versions of IE with regard to "bitness" e.g. 32 vs 64-bit, it is no longer possible to install iMacros in a location other than the Windows Program Files folder on your system drive. This is necessary so that IE can find and load the appropriate iMacros extension according to the bitness of the tab in Internet Explorer.
  40. === Q: I create macros for my clients. Do you have a player? ===
  41. Yes, you can purchase the [http://imacros.net/component-for-net iMacros WebBrowser Component for .NET], which includes a royalty-free license for distributing/offering your iMacros solutions to users external to your company. This license allows you to ship macros and programs based on the iMacros Enterprise Edition to your customers without royalty payment. As a component owner you also have the option of creating your own custom-branded browser automation application. For more information, please see this [http://imacros.net/store/compare-versions#distribute page].
  42. Technically speaking, this means that if iMacros is unlocked with the iMacros Player license key, your users have all the features of the Enterprise Edition available except the ability to record new macros. For more details please see [http://imacros.net/store/compare-versions/#player here].
  43. === Q: How do I download and install the Player? ===
  44. There isn't a separate install for the Player per se. All you need to do is activate the [http://www.imacros.net/download trial version] with your Player key and it "becomes" the Player (users have all the features of the Enterprise Edition available except the ability to record new macros). For more information about distributing iMacros to your users, please see [[Distributing iMacros]].
  45. === Q: How can I automatically install iMacros? ===
  46. General information can be found under [[Distributing iMacros]].
  47. === Q: Is there a network installation available for the install of the player? ===
  48. You can create network installs either by using the command line options provided by the installer (see [[Distributing iMacros]]).
  49. === Q: Why does iMacros still run in trial mode even though I've already entered my key? ===
  50. The license is associated with the Windows user account you are logged into when you activate iMacros. If you then run iMacros from a different user account on the machine, you will also have to enter the key into that account. This is also the case if you are launching iMacros from a scheduled task that runs under a different user account. Multiple activations on the same machine only count as one license.
  51. For iMacros 10.02 and older:
  52. Alternatively, you can pass the license key to iMacros from the command-line using the [[-key]] switch, or by passing it into the call to [[iimOpen#Options|iimOpen]] if you are using the iMacros scripting interface.
  53. === Q: What if the iMacros icon does not appear in the IE toolbar? ===
  54. If you have previously customized your Internet Explorer toolbar the new iMacros icon does not appear by default. You need to add it to the Internet Explorer toolbar manually:
  55. [[Image:Internet-explorer-view.png|thumb|250px|Internet Explorer View]]
  56. 1. To add the icon, open your Internet Explorer and in the menu select View > Toolbars> Customize
  57. [[Image:Customize-toolbar.png|thumb|250px|Customize Toolbar]]
  58. 2. Select the iMacros icon from the list of "Available Toolbar Buttons" and add it.
  59. Tip: For '''IE9''' specific tips see [[IE9 Nags]]. For more general IE tips see [[IE Nags]].
  60. 3. Done! The icon appears in the toolbar.
  61. Note: This behavior is a feature of Internet Explorer - and not "bug" with the iMacros software. Microsoft's philosophy behind this seems to be that users who customized their browser toolbar once do not want new icons added automatically.
  62. === Q: Is the license key tied to one physical machine? ===
  63. Prior to iMacros 10.1, the iMacros license is NOT hardware locked. You can un-install the software on one machine and move it to another machine without problems as often as you need.
  64. iMacros 10.1 and later utilize online activation. In order to transfer your license to another machine, you must first deactivate the license (Help > Activate iMacros > Remove License) and then reactivate iMacros on the new machine. See this [[FAQ#Q:_Is_the_license_key_tied_to_one_physical_machine.3F|FAQ]] for other ways to deactivate.
  65. The Enterprise Player license included with the Enterprise Edition allows an *unlimited* number of users and installations of the iMacros Player *within* your company or organization. For public distribution of your solution without royalty payment, an iMacros WebBrowser Component for .NET license is required (even if you are building solutions with the Standard or Enterprise edition for external distribution).
  66. === Q: How do I deactivate my iMacros license in order to e.g. move it to another machine? ===
  67. This applies to iMacros 10.1 and later, which use online activation. There are a few different ways you can deactivate the license:
  68. # From the iMacros sidebar, go to Help > Activate iMacros and click the Remove License button.
  69. # Uninstall iMacros. When you uninstall iMacros, the license is automatically revoked from that machine.
  70. # Deactivate it within the [http://www.ipswitch.com/nmportal Customer Portal]. If you don't have access to the machine, you can still deactivate the license by logging into your portal account, finding the license on the My Products page and clicking the Deactivate icon (see screenshot for this [[FAQ#Q:_Where_do_I_find_my_Activation_Key.2C_License_File.2C_or_Serial_Number.3F|FAQ]]).
  71. === Q: Why does the Event Viewer show .NET Runtime 2.0 errors when running iMacros? ===
  72. iMacros 7 and later is dependent on the .NET Framework 3.5 SP1.
  73. You might have a broken or corrupted installation of the .NET Framework on your machine. Try using the normal .NET uninstall/reinstall steps to reinstall .NET 3.5 SP1. If this still does not solve the problem, follow the instructions for Method 2 on this page: http://support.microsoft.com/kb/976982
  74. === Q: Why is Firefox automation with the scripting interface using iimOpen("-fx") no longer working? ===
  75. Please make sure you have installed the correct combination of iMacros as well as iMacros for Firefox.
  76. See this forum post for details: [http://forum.imacros.net/viewtopic.php?f=8&t=12254#p36036 How to automate Firefox with iimInit("-fx")]
  77. === Q: Why does iMacros crash on startup or crash often on Windows Server 2008 R2? ===
  78. Crashes on startup usually indicate that Microsoft .NET 3.5/4 is either not installed or not enabled on the system. These may be disabled by default on Windows 2008 R2, so double-check your setup. iMacros 9.01 and later require .NET 4, while earlier versions require .NET 3.5.
  79. Problems with crashes due to the following modules have been reported with several applications in Windows 2008 R2, including Microsoft Office, Skype, Adobe Acrobat Reader, etc.:
  80. * Faulting module name: rtutils.dll
  81. * Faulting module name: jscript9.dll
  82. Here you can see some of those reports: [http://forum.sysinternals.com/application-crash-on-windows-server-2008-r2-rds_topic21453.html Application crash on Windows Server 2008 R2 RDS]
  83. In all those reports, Remote Desktop Services was enabled.
  84. The only solution that we have found is to turn off DEP ([http://msdn.microsoft.com/en-us/library/windows/desktop/aa366553(v=vs.85).aspx Data Execution Prevention]) for that application, in our case iMacros.exe and iMacros.Sidebar.exe. For an example of how to do this, see [http://forum.imacros.net/viewtopic.php?t=12154 this forum post] and also [http://technet.microsoft.com/library/cc700810.aspx#XSLTsection124121120120 How to Configure Memory Protection in Windows].
  85. == Creating Macros ==
  86. === How to ===
  87. ==== Q: A link changes every time I visit the web page ("session ID"), how can I replay the macro without error? ====
  88. By default, iMacros tries to define a an HTML element by its ID or text. If these attributes do not exit, it uses the URL of the element (typically a link). The problem: Some websites create links with a "session id" that is different each time you log in. This is no problem for iMacros.
  89. There are two options to work with such links:
  90. If you want or need to use the URL, edit the macro manually after you recorded it and replace the id (or any other changing part of the string) with the '''wildcard *'''. This method is described in detail in '''[[Form_Filling#Fine_Tune_TAG_Commands|Fine Tune TAG Commands]]'''.
  91. Related Forum posts:
  92. *[http://forum.imacros.net/viewtopic.php?f=11&t=6792 Changing macro script line]
  93. *[http://forum.imacros.net/viewtopic.php?t=3887 Problem with e-mail login]
  94. *[http://forum.imacros.net/viewtopic.php?t=3692 Click on changing link]
  95. *[http://forum.imacros.net/viewtopic.php?t=129 How to click multiple links on search results page]
  96. (tinyurl to above FAQ: http://tinyurl.com/6j4pjh)
  97. ==== Q: Can I use a wildcard in a URL GOTO command? ====
  98. You can't use a wildcard in a URL GOTO, as iMacros has no idea what the value should be. Your only option is to click it on a link, or find somewhere that the session id is written on the page, and extract it for re-insertion into the URL GOTO command.
  99. ==== Q: How can I print a selected frame? ====
  100. If the page uses frames and you want to print only a specific frame, select this frame with ''[[DS]] CMD=CLICK'' first before you use PRINT. An example macro can be found in the [[PRINT|PRINT]] chapter of this manual.
  101. <br>
  102. ==== Q: Some websites require me to enter a graphical "security code" or Turing number. I want the login macro to stop at this point and enter the characters manually. How do I set the focus to a input field for manual entry? ====
  103. To set the focus to a certain input field (or any other element on the screen), please use the ''[[DS]] CMD=CLICK'' command.
  104. Alternately, you could use the [[PROMPT]] command to pause the script and request the desired information from your user. It would look something like this:
  105. Macro Code
  106. VERSION BUILD=5100314
  107. TAB T=1
  108. TAB CLOSEALLOTHERS
  109. URL GOTO=https://s226.lanxtra.com/servlet/SLogin?template=/0/en/sloginsc.vm&login=true
  110. SIZE X=801 Y=602
  111. TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:form1 ATTR=NAME:memberNumber CONTENT=TEST
  112. PROMPT Please<SP>enter<SP>the<SP>value<SP>of<SP>the<SP>Random<SP>Code !VAR1
  113. TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:form1 ATTR=NAME:imageword CONTENT=<nowiki>{{!VAR1}}</nowiki>
  114. TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:form1 ATTR=NAME:&&VALUE:Next<SP>-->
  115. This will pop up a box with the selected text and will not continue until the user clicks ok.
  116. ==== Q: Is it possible to create macros that will run on the page displayed in the web browser, rather than using the URL GOTO command to direct it to a web page at the beginning of a macro. The pages I want to run macros on are all set out identically so one macro should work on all the pages. ====
  117. The URL command is inserted by default every time you start recording a macro. After recording a macro, edit the macro source and manually remove the URL GOTO command. If you want to run the same macro on different pages, yet not all pages are exactly the same, use SET !ERRORIGNORE YES to simply skip TAG commands that cannot be executed.
  118. ==== Q: How can I read and write from a database? ====
  119. Database integration is very easy with iMacros thanks to its powerful Scripting Interface. iMacros can connect to any Windows database, for example Access or SQL Server, but also MySQL. The Scripting Interface can be used from any Windows programming or scripting language like Excel VBA, Foxpro, Perl, C, C++, Java with no problems.
  120. Please see the following example scripts, which are installed in the iMacros\Examples\Windows Scripting Host folder:
  121. * "extract-2-file.vbs" (uses wsh-extract-and-fill-part1 and wsh-extract-and-fill-part1 macros)
  122. * "extract-2-database.vbs" (store information from a website in a database)
  123. * "file-2-web.vbs", "database-2-web.vbs" (reads a text file or database and submits the content to a website)
  124. ==== Q: How do I make the macro continue (and not stop), if somewhere in the macro I get a timeout or error? ====
  125. Please add the command SET !ERRORIGNORE YES to your macro.
  126. ==== Q: How can I do calculations in a macro? ====
  127. For very simple calculations, iMacros offers the [[ADD]] command. And since version iMacros 7.5 and iMacros for Firefox 7.4.0.4, you can also use [[EVAL]].
  128. But instead of doing calculations in the macro, you can perform the calculations inside a script (e.g. Visual Basic Scripting, VBS). This allows you to use all kinds of more sophisticated calculations, loops (e.g. for....next loops) or conditional logic (e.g. if/then) for automating your web tasks. You can then use iimSet of the Scripting Interface to send values to a macro and the EXTRACT command to return values from a macro to the script.
  129. The file [[Random-Numbers.vbs]] demonstrates how to use a script to generate random numbers and modify the macro based on the outcome. Or see the file extract-and-fill.vbs on how to extract a value, subtract a number from it, and re-submit the new value to the website.
  130. Note that VBS files are not started from within the iMacros Browser. You can locate the file (e.g. via Explorer) and then simply double-click on the VBS file. Windows will then start to process the VBS file. The iMacros Browser is started by the VBS file via the iimInit command automatically.
  131. More information about VBS files can be found in our online Windows Scripting Host tutorial or in this manual.
  132. ==== Q: How do I link several macros together or run one after the other? ====
  133. There are several method to combine different macros.
  134. Copy & Paste
  135. <br>
  136. iMacros are simple text files, so you can easily combine (merge) several macros by editing the text files. The .iim macro files can be viewed and edited with an editor (e.g. Notepad), see here.
  137. [[Browser_Automation#Command_Line_Interface_and_Batch_Files|Batch files]]
  138. <br>
  139. If all you need is to run several macros, one after the other, you can call them using the command line interface in a batch file. The -noexit command line switch may prove helpful in this context. Example batch files can be found in the Examples/Batch Files folder of your iMacros installation.
  140. [[Web Scripting|Scripting Interface]]
  141. <br>
  142. You can use the [[iimPlay]] command to run one macro after the other. The following macro continues exactly at the same position where the other macro stopped as the browser window remains open between each macro. Remember to remove the URL GOTO... command from the following macros, if you want it to continue exactly where the other macro left off. To close a browser window, you can use [[iimClose]]. The documented example script combine-macros.vbs can be found in the Examples/Windows Scripting Host folder of your iMacros installation.
  143. ==== Q: If someone needs to make that decision meaning that the task would be partially automated, is there a way to make iMacros stop until a users enters a value and continue afterwards? ====
  144. You can add the [[PROMPT|PROMPT]] command to the macro to make iMacros ask for a variable (e.g. the file name) or simply wait for a click on OK. Or use [[PAUSE]].
  145. ==== Q: How can I create a macro that can select one from a series of radio buttons? I want to avoid setting up separate macros for each selection. ====
  146. You can use [[Variables|variables]] to select a radio button. For example, instead of using one of these three lines:
  147. TAG POS=1 TYPE=INPUT:RADIO FORM=ACTION:/cgi-bin/Info.cgi ATTR=NAME:lunch CONTENT=yes
  148. TAG POS=1 TYPE=INPUT:RADIO FORM=ACTION:/cgi-bin/Info.cgi ATTR=NAME:lunch CONTENT=no
  149. TAG POS=1 TYPE=INPUT:RADIO FORM=ACTION:/cgi-bin/Info.cgi ATTR=NAME:lunch CONTENT=maybe
  150. You can use:
  151. TAG POS=1 TYPE=INPUT:RADIO FORM=ACTION:/cgi-bin/Info.cgi ATTR=NAME:lunch CONTENT=<nowiki>{{choice}}</nowiki>
  152. and set <nowiki>{{choice}}</nowiki> to either "yes", "no" or "maybe". Please note that this value might be case sensitive. This depends on the website that processes this input.
  153. To assign a value to the variable you can use either the SET command, the -var_varname varvalue command line argument, or the iimSet command of the Scripting Interface.
  154. ==== Q: How to display the content of a variable? ====
  155. For testing and debugging macros it can be useful to display the content of some variables. You can divert the PROMPT command from its intended use for this purpose. If you want to display the value of the two variables, !COL2 and MY_VARIABLE, use the following command
  156. PROMPT <nowiki>{{!COL2}}</nowiki> <nowiki>{{!VAR1}}</nowiki> <nowiki>{{MY_VARIABLE}}</nowiki>
  157. This will open an input dialog for !VAR1. This is the main purpose of a PROMPT command, but for our current use of the command this can be ignored. The input dialog box displays the value of <nowiki>{{!COL2}}</nowiki> as dialog box text and the value of <nowiki>{{MY_VARIABLE}}</nowiki> as input box default value. This allows you to check if these variables are populated correctly.
  158. ==== Q: How to add missing steps? ====
  159. As iMacros macros are simple text files, you can copy steps from one macro to another, cf. http://wiki.imacros.net/Insert_Missing_Steps
  160. ==== Q: How to scroll down a page? ====
  161. [[DS]] and [[IMAGECLICK]] clicks work only in the visible part of the browser window. So it can be required to scroll a certain part of the page into view. This can be done with the following command:
  162. URL GOTO=javascript:window.scrollBy(0,20000)
  163. Just change the y (and/or x) values to whatever you need!
  164. You can also use a simple [[TAG]] command that selects an element somewhere in the area of the page you need to scroll to. The TAG command not only selects the element, ''it also scrolls the page'' so that the element is now visible above the fold. For more information please see the following:
  165. * [http://forum.imacros.net/viewtopic.php?f=6&t=301 How to use DirectScreen with web page elements below the fold.]
  166. * [http://demo.imacros.net Testing Java, Flash and Silverlight Applets] workshop slides.
  167. ==== Q: How to test AJAX? ====
  168. Please see the following forum posts:
  169. * [http://forum.imacros.net/viewtopic.php?t=757 How to handle AJAX] Observe a AJAX clock example
  170. * [http://forum.imacros.net/viewtopic.php?f=14&t=6107 Load and Performance testing of AJAX pages]
  171. ==== Q: Do you support HTML5 web applications testing? ====
  172. Yes, we do.
  173. All HTML5 features can be automated either by normal recording (HTML based) or with the use of our [[DirectScreen]]/[[Image Recognition]] features in the iMacros Browser and Internet Explorer.
  174. iMacros for Firefox/Chrome have limited HTML5 support but we are working on it.
  175. ==== Q: Can a macro start another macro? ====
  176. A macro itself can not run another macro, but there are two powerful options to achieve the same result:
  177. * Use the command line interface via [[Sample_Code#Batch_Files|batch files]].
  178. * Use the Scripting Interface: This is by far the most powerful and flexible method. With the [[iimPlay]] command you can start one macro after the other, and also combine that with logging and error checking. Please see the [[Combine-Macros.vbs]] demo script. It starts three different macros in a row.
  179. ==== Q: How to create nested loops? ====
  180. For simple loops you can use the LOOP button and the [[!LOOP]] variable. However, in many applications you need more complex solutions and nested loops. All this can be done in iMacros via the [[Web Scripting]] interface.
  181. We created some examples using the popular VB Script language, but please keep in mind you can do the same from '''any''' programming or scripting language:
  182. * [[VBS looping]] - General tutorial on how to create (nested) loops
  183. * [[Loop after Query or Login]] - Another typical case: First login to a website and then start the loop over the data
  184. ==== Q: How can I do string manipulation? ====
  185. String manipulation can be done by using [[EVAL]] or, if you are using the scripting interface, sending the text back to the calling script, manipulate it there, and then use it in the next macro:
  186. i = iim1.iimPlay ("GetText")
  187. s = iim1.iimGetExtract (1)
  188. 'Manipulate s here!
  189. s = Mid(s, 3, 3)
  190. 'Send s back to next macro
  191. i = iim1.iimSet ("myvar", s)
  192. 'The macro UseNewText can use the new value with the <nowiki>{{myvar}}</nowiki> variable now
  193. i = iim1.iimPlay ("UseNewText")
  194. ==== Q: How to pass values from one macro to the next? ====
  195. Please see [http://forum.imacros.net/viewtopic.php?f=2&t=11828&p=35476#p35476 Can you pass the coordinates from a macro to another?].
  196. ==== Q: How do I avoid following a link or "clicking" a button using the TAG command? ====
  197. If you want to use a button or a link as reference, you should tag it with TAG ... EXTRACT=TXT, to avoid following the link or "pushing" the button. In that case, do not forget to use SET !EXTRACT NULL, to clear the extract variable before the real extract.
  198. ==== Q: How do I click a button on the browser toolbar, select a browser menu item, or interact with another browser plug-in? ====
  199. iMacros is designed primarily to automate interactions within the actual web page itself. It is not capable of controlling every browser-specific command or menu item, toolbar buttons, or other plug-ins. Flash/Java/Silverlight content displayed on the web page can be automated using iMacros [[DirectScreen]] commands.
  200. ==== Q: How can I tag an element in a frame if the frame number is different each time? ====
  201. Please see the forum topic [http://forum.imacros.net/viewtopic.php?f=6&t=12147 Tag elements in frames with changing frame numbers]
  202. ==== Q: Is there any particular command for right click mouse and choosing a menu item from the list when automating a Flash application? ====
  203. iMacros cannot currently automate menu selections from a context-sensitive pop-up menu (for example, the menu that pops up when you right-click a Flash/Adobe/Java applet).
  204. ==== Q: How can I fill a TinyMCE or CKEditor rich-text edit field? ====
  205. You can actually control TinyMCE simply using it's JavaScript interface and the URL command. This line should do the trick:
  206. URL GOTO=javascript:void(tinyMCE.editors['EDITOR_NAME'].setContent('EDITOR_CONTENTS'));
  207. where EDITOR_NAME is name of the textarea the editor is associated with and EDITOR_CONTENTS is what you want to set the contents to (remember to keep the iMacros syntax - <SP> instead of space etc.).
  208. Example macro:
  209. VERSION BUILD=7031111 RECORDER=FX
  210. URL GOTO=http://tinymce.moxiecode.com/tryit/full.php
  211. WAIT SECONDS=5
  212. <nowiki>URL GOTO=javascript:void(tinyMCE.editors['content'].setContent('My<SP>content<SP>filled<SP>by<SP><b>iMacros</b>'));</nowiki>
  213. (should open the TinyMCE example page and after 5 seconds change the editor content to My content filled by iMacros)
  214. Related forum thread: [http://forum.imacros.net/viewtopic.php?f=11&t=11167&start=0 TinyMCE Editor]
  215. The same approach can be used to fill a CKEditor field or any other field that exposes a Javascript API:
  216. URL GOTO=http://ckeditor.com/demo
  217. TAG POS=1 TYPE=A ATTR=ID:demo3
  218. <nowiki>URL GOTO=javascript:CKEDITOR.instances.editor2.setData('My<SP>content<SP>filled<SP>by<SP><b>iMacros</b>');</nowiki>
  219. ==== Q: How to access the DOM from iMacros for Firefox Javascript ====
  220. In order to access the web page DOM, you need to prefix your reference to the document object with "window". For example:
  221. var reportDataTable = window.document.getElementsByTagName("form")[0].getElementsByTagName("table")[0];
  222. ==== Q: How can I make the macro play a sound? ====
  223. The iMacros language itself does not support the ability to play a sound. However, one way to do this is by adding the following line to your macro:
  224. URL GOTO=file://C:\Windows\Media\chimes.wav
  225. This will cause the browser to open the Windows media player and play the sound.
  226. If you are using the build-in Javascript scripting interface with iMacros for Firefox, you can use the following Javascript code:
  227. var sound = Components.classes["@mozilla.org/sound;1"].createInstance(Components.interfaces.nsISound);
  228. sound.beep();
  229. ==== Q: I have to copy and paste a large amount of text from a file into a single, large text box. I see how to manage one line of text, but there are hundreds of lines of text. How is that accomplished? ====
  230. See [http://forum.imacros.net/viewtopic.php?f=15&t=18475 How to enter a large amount of text into a text area field]
  231. ==== Q: How can I prevent my Player-only users from editing macros? ====
  232. It is possible to prevent users from editing macros by using the macro encryption functionality built into the iMacros Enterprise Edition.
  233. To encrypt a macro, first select the macro in the iMacros sidebar and then select Tools - Obfuscate macro from the main menu of the iMacros Browser. You will only distribute the encrypted macro files (.iimx) to your users.
  234. You also need to give your users the password you chose so that the macro can be decrypted during playback, but users will not see the macro code as it is playing nor will they be able to edit the file.
  235. [[Image:Macro Decryption Key.png|500px|center]]
  236. ==== Q: Why can't I call Java objects/functions from my .js macros in iMacros for Firefox anymore? ====
  237. In short, you can not use Java with iMacros for Firefox anymore.
  238. Replaying of Javascript files in iMacros for Fx was made sandboxed since 7.5.2.0, which prevents anything but very basic Javascript functions.
  239. Firefox 16 also drops the support for java.*
  240. These two facts prevent you from using Java if you use either Firefox >= 16 or iMacros >= 7.5.2.0.
  241. See the forum thread [http://forum.imacros.net/viewtopic.php?f=11&t=18783&p=50596#p48979 Firefox 16 removes support for "java" DOM object] for more information.
  242. ==== Q: How can I enter spintax with iMacros? ====
  243. Please see [http://forum.imacros.net/viewtopic.php?f=11&t=13857 this forum thread].
  244. ==== Q: Why doesn't the Image Validation Wizard "see" the embedded Java application on the page? ====
  245. In some cases, you may need to run a macro containing the following command before iMacros (and the Image Validation Wizard) will capture an image of the Java application:
  246. SET !X_V7_SCREENSHOT_METHOD GDI
  247. ==== Q: Why are the image validation commands not working for an embedded Java application? ====
  248. See the response to the [[FAQ#Q:_Why_doesn.27t_the_Image_Validation_Wizard_.22see.22_the_embedded_Java_application_on_the_page.3F|FAQ above]].
  249. === Issues during Replay ===
  250. ==== Q: Does iMacros work with every web site? ====
  251. The macros recorded with iMacros work on almost all sites. Even if the standard click methods fail (for example on Flash of Java applets) the [[DS|DirectScreen]] command can be used in almost all cases. If you think you have found a web site where iMacros does not work please let us [http://www.imacros.net/service/contact/ know]. We are very interested to hear of such cases and will assist you in finding a solution.
  252. ==== Q: Can a macro recorded in one browser be played in a different browser? ====
  253. Yes! In most cases no changes are required to your macro to play it in a browser different from that in which it was originally recorded. This is especially true for playing the same macro in IE and the iMacros browser, since they are based on the same browser engine.
  254. However, please bear in mind that there can be significant differences between browser platforms in the way they are implemented and how they render web pages. Additionally, iMacros for Firefox and Chrome share a different code base and feature set than iMacros for IE and the iMacros browser. While we strive to maintain compatibility and consistency between the different versions of iMacros as much as possible, it still may be necessary to manually tweak a macro before it will work across browsers, and in some cases it may not be possible at all to create one macro that will work the same in different browsers.
  255. ==== Q: We have a macro that goes to a web site and issues a query. The result is a variable list of links that all need to be clicked and the result saved for each link. Can this be accomplished using the tool? ====
  256. Basically what you need is a macro that first navigates to your website, runs the query and then loops over the result. The solution is to split the task in two macros. The first macro (macro1) navigates to the site and runs the query. The second macro (macro2) "loops" over the result until all items are processed. Both macros are combined with a small script. Note that you have to manually remove the URL GOTO... in macro2. Thus the iMacros Browser continues macro2 exactly at the position where macro1 stopped. As an example, please see the [[Loop after Query or Login]] example script.
  257. ==== Q: Does the macro script wait for the page to fully finish loading? ====
  258. Yes, if a command inside a macro triggers a page (re-)load iMacros automatically waits until the page is completely loaded before it continues with the next command.
  259. One solution that will always work is to use the [[IMAGESEARCH]] command to search for an image. iMacros will wait until this image appears (or the timeout value is reached). This approach looks at the website as if it were an image - just as a human would do! Thus this approach works with every web site, regardless of which web technology is used (HTML, Frames, ASP.NET, Java applet, Flash applet,....).
  260. The same issue is also discussed under an different angle in the [[Web_Testing#Q:_I_want_to_test_that_certain_images_will_show_up_on_my_site_when_a_page_is_loaded|Web Testing FAQ - How to check if an image is already loaded?]].
  261. ==== Q: But I don't want my macro to wait for the page to fully finish loading. How do I tell it not to wait? ====
  262. In this case, you can simply set a low value for the page timeout ([[!TIMEOUT_PAGE]]) and tell iMacros to ignore the timeout error by using SET [[!ERRORIGNORE]] YES. For example:
  263. SET !TIMEOUT_PAGE 1
  264. SET !ERRORIGNORE YES
  265. URL GOTO=...
  266. ' Reset values to defaults
  267. SET !ERRORIGNORE NO
  268. SET !TIMEOUT_PAGE 60
  269. ==== Q: Why is a certain input box never recorded? ====
  270. 1. If all input boxes except one or two are recorded correctly, the problem could be that these boxes have the same internal name. Typically, this occurs with input boxes that are used for "From" and "To" or "Password" and "Re-enter password" type of inputs. If (and only if) both fields have the same internal name iMacros can not fill the fields correctly during replay.
  271. Solution: Manually edit the macro and use POS=2 to reach the second element - the "To" selection in the following example.
  272. URL GOTO=http://www.flybmi.com/bmi/en-gb/index.aspx
  273. SIZE X=800 Y=600
  274. 'Fill FROM field
  275. TAG POS=1 TYPE=SELECT FORM=NAME:IBEMagnet_IBEMagnet__ctl0 ATTR=NAME: CONTENT=$*Dublin*
  276. 'Fill TO field
  277. TAG POS=2 TYPE=SELECT FORM=NAME:IBEMagnet_IBEMagnet__ctl0 ATTR=NAME: CONTENT=$*Frankfurt*
  278. TAG POS=1 TYPE=INPUT:IMAGE FORM=NAME:IBEMagnet_IBEMagnet__ctl0 ATTR=NAME:&&VALUE:
  279. 2. If you click on input boxes and no TAG commands at all are created, you might have encountered a Flash- or Java-based input box (inside a Flash- or Java-Applet) instead of a standard HTML input box. In this case, change the ClickMode to [[Advanced_Use#The_Winclick_command|WinClick]] to record the input.
  280. ==== Q: Why is the dialog "XYZ" not handled by iMacros? [XYZ can be any browser dialog, for example the print, download or save dialog] ====
  281. This issue can have several causes. Here are some questions in order to diagnose this problem:
  282. Dialog is not recognized during Recording
  283. · During recording, an iMacros dialog should appear under the Web Browser dialog. If the iMacros dialog does not appear, please make sure that the option "Use IM Dialog Manager" is checked in the Browser tab of the Options dialog.
  284. · If this option is checked and the dialog is still not recognized, please play the "Demo-Javascript", Demo-Download" or "Demo-SaveAs" macro. Are the dialogs in these macros handled correctly? If not, try reinstalling the software or [http://imacros.net/support/professional-services contact tech support].
  285. · Does the dialog appear before you start recording? This could happen, for example, with a login dialog. To work around this, start recording at a different page, and enter your real web site address. You can always edit the macro after recording and remove the first URL.
  286. · If the dialog is still not recognized: Is the dialog in our list of supported dialogs? If yes, try adding the commands manually to the macro and test if everything works correctly during replay.
  287. 2. Dialog is recorded, but not managed during Replay
  288. · If the dialog appears at the end of the macro, it can be that the macro stops shortly before the dialog appears and thus cannot "catch" it. To work around this, add a WAIT SECONDS=3 command after the command that triggers the dialog to make sure iMacros is still active when the dialog appears.
  289. ==== Q: How do I make the IM Browser appear as native IE (Internet Explorer)? ====
  290. Open the iMacros IE Plug-in or the iMacros Browser and open the Options dialog. In the Options dialog, select the Browser tab and choose "Stealth mode (Identify as native Internet Explorer)". In this mode the iMacros Browser appears to a web server '''exactly''' the same as Internet Explorer.
  291. See also [[FAQ#Q: The web page I am accessing requires Internet Explorer (IE). Is this a problem?]]
  292. ==== Q: How to authenticate at a proxy server? ====
  293. Problem: The issue is that we have username /password to get to internet websites which means we are authenticated at the proxy server. iMacro fails to wait asking for username /password and just goes ahead and says since
  294. proxy is not authenticated we get the error from proxy server .
  295. Solution: Please make sure that you have the [[ONLOGIN]] command '''before''' the first URL GOTO= command.
  296. ONLOGIN USER=user PASSWORD=password
  297. URL GOTO=http://www.imacros.net
  298. ==== Q: Why does my output file start with three weird characters? ====
  299. Those extra codes at the beginning of the file are the [http://unicode.org/faq/utf_bom.html#BOM Byte Order Mark (BOM)] and identify the file as being UTF-8 encoded.
  300. ==== Q: How do I prevent iMacros from "stealing" the focus? ====
  301. Please see the following forum thread: [http://forum.imacros.net/viewtopic.php?t=2854&f=6 iMacros stealing focus]
  302. ==== Q: How to respond to a Refresh/Resend dialog? ====
  303. Please see the following forum thread: [http://forum.imacros.net/viewtopic.php?f=11&t=13461 How to respond to a Refresh/Resend dialog]
  304. ==== Q: Why am I being asked to enter my license key every time I call iMacros from a script even though I already entered the key into the browser? ====
  305. It is important that the license key is associated with the same user account that actually launches iMacros. If you are launching iMacros e.g. from a PHP script on your web server, then you need to make sure the key is entered for the user account under which your web server runs.
  306. Alternatively, you can pass the license key to the browser using the [[-key]] switch in the first parameter to [[iimOpen#Parameters|iimOpen]].
  307. ==== Q: What factors can cause a macro that uses DirectScreen or image recognition to fail on different machines? ====
  308. The biggest factor in making sure that an Image Recognition or DirectScreen macro will work consistently across machines is the browser window size. The browser size on playback needs to be the same as the size used to record the macro. This is why iMacros will automatically add a SIZE command to the macro when recording in DirectScreen mode.
  309. Related to this is desktop resolution. The desktop size on each machine needs to be large enough to accommodate the browser window size required by the macro (conversely, the browser window size should not be larger than the desktop resolution). Please note that the SIZE command ensures that the visible browser ''<u>page</u>'' is the specified size. The actual size of the entire browser window will be larger than the specified values when you factor in the size of the sidebar, toolbars, etc.
  310. Another thing that can potentially affect the size of the visible browser page is the iMacros sidebar. You may want to ensure that the width of the sidebar is the same on each machine.
  311. When using image recognition, desktop color resolution is another factor to consider. Although iMacros is more tolerant of color differences, you should still make sure that the desktop color resolution on each machine is the same as the machine used to create the target images. This is usually not an issue since most computers today are set to 32-bit color resolution by default.
  312. Lastly, make sure the machines are as similar as possible with regard to OS, iMacros version, and version of IE installed.
  313. To summarize issues that can affect Image Recognition/DirectScreen:
  314. # Browser window size ([[SIZE#Notes|the size of the visible portion of the web page]])
  315. # Desktop resolution (as it relates to accommodating the required browser size)
  316. # iMacros sidebar width
  317. # Desktop color resolution
  318. # Machine homogeny
  319. ==== Q: What does the error "Not enough storage is available to process this command" mean? ====
  320. The most likely cause of this error is due to a memory leak in IE and not iMacros itself (the iMacros Browser uses the [[FAQ#Q:_What_is_the_functional_difference_between_Internet_Explorer_with_iMacros_turned_on.2C_and_the_iMacros_browser.3F|core IE components]]).
  321. This is why we recommend periodic browser restarts when playing long-running macros or macros that do many iterations (loops) and navigations. For some guidelines, see [[Web_Testing#Q:_How_can_I_set_up_a_24_hours_a_day.2C_7_days_a_week_.28non-stop.29_operation_with_iMacros.3F|this article]].
  322. ==== Q: Why is there no page (or the wrong page) displayed when a new tab opens in the iMacros Browser? ====
  323. Some websites require a special setting for the new tab to work correctly in the iMacros Browser or when using the iMacros WebBrowser Component for .NET. Add the following command to the beginning of your macro:
  324. SET !X_PERM_NEW_WINDOW_BEHAVIOR TABS_CONNECTED
  325. For more information about this command, please see [[!X_PERM_NEW_WINDOW_BEHAVIOR]]
  326. == Extracting Data ==
  327. === Q: I use the EXTRACT command and get the message "Extraction anchor not found". What is the solution? ===
  328. The reason for this message is that the extraction anchor, given mainly by the ATTR parameter of the TAG command, could not be found on the currently active web site.
  329. Here are some tips on creating good extraction anchors:
  330. Make sure that you selected the appropriate part for the anchor. It should only contain HTML code that does not change during each session or the changing parts need to be replaced by the wildcard *.
  331. Incorrect: This anchor does not work because it contains a changing value (the dollar amount).
  332. TAG POS=12 TYPE=TD ATTR=TXT:Price<SP>US$<SP>3.50 EXTRACT=TXT
  333. Correct: Replaced changing part with asterisk *
  334. TAG POS=12 TYPE=TD ATTR=TXT:* EXTRACT=TXT
  335. To test your anchor please make sure you click on "test_EXTRACT_tag" after iMacros suggests an anchor element or you have manually created one. Most extraction issues are detected with the test feature.
  336. Experiment with the POS attribute. POS indicates which of a number instances of the same anchor on a web page should be extracted.
  337. If the information you want to extract is inside a framed web site you need to click inside the frame that contains the information you want to extract before opening the Extraction Wizard. This generates the FRAME command and marks the frame as active for the extraction.
  338. === Q: I require macros that can extract simple text data from a web page and then insert the extracted information back into either the same web page or another web page. I do not need to store this data in any way. In effect all I need to do is copy and paste the text data. ===
  339. Extracted data is saved in the !EXTRACT variable. You can assign the extracted value to a variable and use it again at a later point in your macro.
  340. TAG POS=29 TYPE=TD ATTR=TXT:* EXTRACT=TXT
  341. SET !VAR1 <nowiki>{{!EXTRACT}}</nowiki>
  342. ...
  343. TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f1 ATTR=NAME:n1 CONTENT=<nowiki>{{!VAR1}}</nowiki>
  344. === Q: How do I extract information from a table with variable length and/or more than one page? ===
  345. This task occurs often e.g. when you extract data from a database (search engines, flight schedules, news service). Depending upon your keyword you might get zero, one, two or 500 entries back. To extract this data you need to divide your macro into two separate macros as described here. Your second macro consists of just one extraction tag for one line of the table, e.g.:
  346. TAG POS=<nowiki>{{mypos}}</nowiki> TYPE=TD ATTR=TXT:<SP>noWrap>*EUR* EXTRACT=TXT
  347. After replaying the first macro, which navigates to the results, you need to loop through the results by changing the POS parameter, i.e. the mypos variable from 1 to 999. This line would be the content of the "macro_extract" macro in the source code sample below. It extracts the EUR price on each line.
  348. Once you get the #EANF# message back instead of a result you know that you reached the end of the table on the current page.
  349. If necessary, you can now run another macro to click on a "NEXT" link for another page of results. If no "NEXT" link is found then you know that you are done.
  350. Here is a Visual Basic source code snippet, that shows how the different macros are used:
  351. 'Read keywords
  352. For i1 = 1 To 999 '<<<<<<<<< LOOP Keywords until all words processed (=> Read_Line returns "ERROR")
  353. sKeyword = Read_Line(mFileInput, i1) 'Read keyword from a text file
  354. If sKeyword = "ERROR" Or Len(sKeyword) < 2 Then
  355. Exit For
  356. End If
  357. iRet = iim1.iimDisplay("Search: " + sKeyword)
  358. iRet = iim1.iimSet("-var_search", sKeyword)
  359. iRet = iim1.iimPlay("macro_search")
  360. sData = iim1.iimGetLastExtract()
  361. iRet = iim1.iimDisplay("Extract: " + sKeyword)
  362. For i2 = 1 To 999 '<<<<<<<<<<<<<LOOP "next" links
  363. 'Loop all NEXT links until error => no more NEXT links to process)
  364. For i3 = 1 To 999 '<<<<<<<<<<<<<<< LOOP table lines and extract them
  365. 'Loop the table rows until an error occurs => no more data on this page
  366. DoEvents
  367. iRet = iim1.iimSet("-var_mypos", CStr(i3))
  368. ' iRet = iim1.iimDisplay(sKeyword + "P:" + CStr(i2) + "L:" + CStr(i3))
  369. iRet = iim1.iimPlay("macro_extract")
  370. sData = iim1.iimGetLastExtract()
  371. If iRet = 1 and len (sData) > 0 Then
  372. s1 = iim1.iimGetLastExtract(1)
  373. s2 = iim1.iimGetLastExtract(2)
  374. s3 = iim1.iimGetLastExtract(3)
  375. 'Check if data found, and save it to a file
  376. i = InStr(s0, "#EANF#")
  377. If i <= 0 Then
  378. sLine = sKeyword + sSep + CStr(i2) + sSep + CStr(i3) + sSep + s1 + sSep + s2 + sSep + s3
  379. Call Write_Line(mFileOutput, sLine)
  380. Else
  381. Exit For 'next page
  382. End If
  383. Else
  384. Exit For 'next page
  385. End If 'iRet
  386. Next 'table rows loop
  387. iRet = iim1.iimDisplay(sKeyword + " Page: " + CStr(i2))
  388. iRet = iim1.iimPlay("macro_next")
  389. If iRet < 0 Then
  390. Exit For 'next keyword
  391. End If
  392. Next 'NEXT links loop
  393. Next 'Keyword list loop
  394. iRet = iim1.iimDisplay("Extraction completed")
  395. Note: The support functions used in this example are:
  396. Function Read_Line(sFile, iline) As String
  397. Dim sValue
  398. Dim i As Integer
  399. Dim bFound As Boolean
  400. bFound = False
  401. Open sFile For Input As #1
  402. i = 1
  403. Do While (Not EOF(1) And bFound = False)
  404. Input #1, sValue
  405. If i = iline Then bFound = True
  406. i = i + 1
  407. Loop
  408. Close #1
  409. If bFound = False Then
  410. sValue = "ERROR"
  411. End If
  412. Read_Line = sValue
  413. End Function
  414. Public Sub Write_Line(sFile, sLine)
  415. Open sFile For Append As #2
  416. Print #2, sLine
  417. Close #2
  418. End Sub
  419. === How do I loop through multiple pages of results? ===
  420. See the following:
  421. * [[FAQ#Q:_How_to_create_nested_loops.3F|How to create nested loops]]
  422. * [http://forum.imacros.net/viewtopic.php?f=7&t=10390&start=15#p33539 Yellow Pages example]
  423. === Q: How do I extract data from a hidden input field? ===
  424. Sometimes web forms contain internal data that is passed between pages in hidden input fields. Since you can not see these fields you can not record extracting visually, but you can edit the recorded macro afterwards and manually create a TAG...EXTRACT command for the hidden field. How this is done is described in the [[Data_Extraction#Manual_Creation|extract]] chapter and at the [[TAGs and HTML]] chapter.
  425. === Q: How do I extract text from a (Javascript) message box? ===
  426. You only need to add:
  427. SET !EXTRACTDIALOG YES
  428. to your macro and the text of a message box is extracted. The text is processed the same way as standard extracted text. Examples of Javascript dialogs can be found in the demo macros "Demo-JavascriptDialog" and "Demo-OfflineDialogs".
  429. === Q: How do I extract text from a Flash applet? ===
  430. Unfortunately it is not currently possible to extract text/data from a Flash application with iMacros.
  431. Suggested workaround: Use the iMacros screenshot feature and then use this screenshot as input for an OCR program.
  432. === Q: Sometimes multiple items inside one cell are separated by <nowiki><br></nowiki> instead of creating individual cells for the data. How do I extract data separated with <nowiki><br></nowiki>? ===
  433. To work around this problem use the TYPE=HTM extraction. It preserves all HTML tags inside the text so that the extraction result can be separated later. See also the "Demo-Extract" example macro for more details.
  434. === Q: How do I extract the page URL? ===
  435. The URL of the current page is stored in the internal variable <nowiki>{{!URLCURRENT}}</nowiki>. You can use this value inside commands like any other variable, or extract it by assigning the value to the EXTRACT command:
  436. SET !EXTRACTADD <nowiki>{{!URLCURRENT}}</nowiki>
  437. === Q: How do I extract the content of an Input Box? ===
  438. If you already recorded a macro, check if the extraction TAG command contains the "CONTENT" parameter. If if does, delete it.
  439. Creating the extraction command semi-manually (without the [[Advanced_Use#Extract_Data_from_Websites | Extraction Wizard]]):
  440. * When recording, click the input box(which is recorded as a TAG command)
  441. * After recording:
  442. ** Add "EXTRAXT=TXT" to this TAG
  443. ** Delete the CONTENT parameter ("CONTENT=...") from this TAG
  444. The result then looks like
  445. TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:form1 ATTR=ID:TF2 EXTRACT=TXT
  446. === Q: How can I skip fields that may not appear on the page? ===
  447. When you attempt to extract a value from an element that doesn't appear on the page, iMacros simply sets the extracted value to #EANF# (extraction anchor not found) and continues processing the rest of the macro. This is by design to make sure that iMacros extracts only the intended value (if the extraction element exists) or no value (#EANF#) if the element is not found.
  448. If you use '''relative''' extraction and a certain data record (e. g. a phone number) is missing on a page, then the macro would normally stop with a TAG error as the TAG for the anchor fails. But that is not what you want during an extraction: You simply want the macro to continue and extract all other values that exist. => Solution: '''Add ''SET !ERRORIGNORE YES'''''.
  449. Note that when the anchor TAG immediately before a '''relative''' extraction fails, then the extraction itself also fails (the extracted value is set to #EANF#). This is also by design.
  450. Example (skip a missing value with relative extraction):
  451. URL GOTO=http://demo.imacros.net/Automate/Extract2
  452. SET !ERRORIGNORE YES
  453. 'Correct: TAG POS=1 TYPE=DIV ATTR=TXT:MyTable
  454. TAG POS=1 TYPE=DIV ATTR=TXT:MyTableOTHERNAME
  455. TAG POS=R3 TYPE=TD ATTR=TXT:* EXTRACT=TXT
  456. OTHERNAME was added to the ''TXT:MyTable'' attribute to trigger the extraction anchor failure for demo purposes.
  457. == Using the iMacros WebBrowser Component for .NET ==
  458. === Q: I did not find the timeout parameter in the Play command of the iMacros component. How can I specify the macro timeout in this component like I do in the iMacros scripting interface? ===
  459. Please see the article on [[Timeout Tutorial|Timeouts]] and the explanation of [[Timeout_Tutorial#Timeout_in_the_iMacros_Component_for_.NET|Timeout in the iMacros Component for .NET]].
  460. === Q: I don't need to display or handle any browser UI. Is it possible to use the component in a "silent" mode just like the iMacros Browser? ===
  461. Just like we do in the iMacros Browser, in your application code you would have to Hide() the form containing the component. There are a few complications in the iMacros Browser that force us to use something more complicated than the simpler Hide() method, but you will have to figure out for yourself what works best for your particular application. In case of the iMacros Browser, we have to initialize a bunch of stuff, like the scripting interface, in a given order. Your application might work with Hide().
  462. '''Disclaimer''': DS, Image Recognition, and some dialogs - in particular download dialogs - may not work as expected in hidden forms.
  463. === Q: I am able to use all of the functionality when running in debug mode, but when I compile the application, I get this error: "Unable to load DLL 'iimds.dll': The specified module could not be found." ===
  464. All iMacros dlls which come with the component have to be in the same folder as your application's executable.
  465. When you compile your application in release mode, Visual Studio will copy its dependencies to a folder usually named "Release" (bin\Release). However, since some of the iMacros dlls are loaded only during runtime, VS won't copy them to the final folder. This you have to do manually.
  466. If you still have problems, please make sure that the system where you are running your application has the right version of the VC++ Runtime, as described in the Readme.txt file (it could be the case if you only have Visual Basic 2010 Express).
  467. === Q: Why do I get the "Unable to load iimds.dll" error even though all of the iMacros dlls are located in the same folder as my application exe? ===
  468. The application is failing to launch because the iMacros Component needs the VC++ 2010 SP1 Runtime. The iMacros Standard and Enterprise Edition installers install vcredist 2010 SP1, and so your application works fine if iMacros is previously installed in that system.
  469. The solution is to add the VC++ 2010 SP1 Runtime to the prerequisites of your application in Visual Studio.
  470. === Q: Do you have a 64-bit version of the component? ===
  471. At this time we cannot offer a 64-bit version of the Component. We still have a minor issue with one of the 64-bit dlls we use and the WebBrowser control (in both iMacros Browser and the Component), so we decided to leave the 64-bit for a later point.
  472. === Q: How can I deploy my application with ClickOnce? ===
  473. For [http://msdn.microsoft.com/en-us/library/748fh114.aspx ClickOnce deployment] you have to add all dependencies to your project. Use "Add Existing Item" (Shift+Alt+A), and not "Add Reference". This is the case for all items you want to publish with your project, like a help web page, a readme file, or examples.
  474. The files are going to be listed as application files, which you can then choose to include in the publish package.
  475. In the Prerequisites page, do not forget to add the VC++ 2010 SP1 Runtime Libraries (x86). If you do not see it in the Prerequisites list, refer to Microsoft documentation on creating custom bootstrap packages.
  476. <gallery mode="packed-hover">
  477. File:ClickOnce1.png|Use Add Existing Item
  478. File:ClickOnce2.png|Choose files to publish from Application Files
  479. File:ClickOnce3.png|Add VC++ runtime in prerequisites
  480. </gallery>
  481. === Q: Can I create multiple instances of the component in my application, e.g. using threads? ===
  482. Unfortunately, it is not possible at this time to control two iMacrosControl instances in a single application. There were some design decisions we made where we chose - for performance reasons - to have a few static classes and properties. Two iMacrosControl instances will, of course, share those static objects.
  483. In order to have simultaneous instances of the iMacrosControl, one has to have them in separate applications (processes). If these need to communicate among themselves, you will have to implement some kind of inter-process communication. Basically, you need to create a controller application and a browser application, which contains the iMacrosControl. They would need to be able to communicate with each other using [http://msdn.microsoft.com/en-us/library/vstudio/ms735119%28v=vs.90%29.aspx WCF], for instance. The controller can launch many parallel browsers in different threads.
  484. For further discussion on this topic, please visit [http://forum.imacros.net/viewtopic.php?f=24&t=15314 this forum thread].
  485. === Q: Can I create an application that runs as a Windows Service using the component? ===
  486. Since the component requires a UI, it is not possible to use it in a service application.

comments powered by Disqus