FAQ

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.

Getting started

Q: What is the functional difference between Internet Explorer with iMacros turned on, and the iMacros browser?

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.

But the iMacros Browser has extra functions that are not available in the IE add-on:

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 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.

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.

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.

Q: The web page I am accessing requires Internet Explorer (IE). Is this a problem?

No. iMacros is available as Internet Explorer add-in, so you can run all macros directly inside the real Microsoft Internet Explorer browser.

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.

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.

Q: Are there conditional statements like if... then...else in the iMacros macro language?

[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.]

The iMacros language itself is designed as a descriptive language (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.

So we created the very powerful Scripting Interface that allows you to use iMacros with every Windows Scripting or programming language on the planet. 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.

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 chapter.

iMacros for Firefox also includes a 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).

Q: How do I know whether I should use just a macro or if I need to also use a script for my task?

Please see 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).

Installation

Q: Where do I find my Activation Key, License File, or Serial Number?

Your iMacros serial number, activation key, and license file (required for offline activations and player distribution) can be found by logging into the Customer Portal and clicking the My Licenses option. After activating iMacros, the serial number is also displayed in the Help - About box.

Hover over the product name in the Customer Portal to display the Activation Key and other information.

Update: This has been fixed starting with iMacros 10.4 so that the installation location can now be specified when running the setup wizard.

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.

Q: I create macros for my clients. Do you have a player?

Yes, you can purchase the 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 page.

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 here.

Q: How do I download and install the Player?

There isn't a separate install for the Player per se. All you need to do is activate the 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).

Q: How can I automatically install iMacros?

Q: Is there a network installation available for the install of the player?

You can create network installs either by using the command line options provided by the installer (see Distributing iMacros).

Q: Why does iMacros still run in trial mode even though I've already entered my key?

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.

For iMacros 10.02 and older:

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 if you are using the iMacros scripting interface.

Q: What if the iMacros icon does not appear in the IE toolbar?

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:

Internet Explorer View

1. To add the icon, open your Internet Explorer and in the menu select View > Toolbars> Customize

Customize Toolbar

2. Select the iMacros icon from the list of "Available Toolbar Buttons" and add it.

Tip: For IE9 specific tips see IE9 Nags. For more general IE tips see IE Nags.

3. Done! The icon appears in the toolbar.

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.

Q: Is the license key tied to one physical machine?

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.

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 for other ways to deactivate.

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).

Q: How do I deactivate my iMacros license in order to e.g. move it to another machine?

This applies to iMacros 10.1 and later, which use online activation. There are a few different ways you can deactivate the license:

From the iMacros sidebar, go to Help > Activate iMacros and click the Remove License button.

Uninstall iMacros. When you uninstall iMacros, the license is automatically revoked from that machine.

Deactivate it within the Customer Portal. If you don't have access to the machine, you can still deactivate the license by logging into your portal account, pulling up the license, and click the Deactivate link (see screenshot for this FAQ).

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

Q: Why is Firefox automation with the scripting interface using iimOpen("-fx") no longer working?

Please make sure you have installed the correct combination of iMacros as well as iMacros for Firefox.

Q: Why does iMacros crash on startup or crash often on Windows Server 2008 R2?

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.

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.:

Creating Macros

How to

Q: A link changes every time I visit the web page ("session ID"), how can I replay the macro without error?

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.

There are two options to work with such links:

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 Fine Tune TAG Commands.

Q: Can I use a wildcard in a URL GOTO command?

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.

Q: How can I print a selected frame?

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 chapter of this manual.

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?

To set the focus to a certain input field (or any other element on the screen), please use the DS CMD=CLICK command.

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:

This will pop up a box with the selected text and will not continue until the user clicks ok.

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.

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.

Q: How can I read and write from a database?

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.

Please see the following example scripts, which are installed in the iMacros\Examples\Windows Scripting Host folder:

"extract-2-database.vbs" (store information from a website in a database)

"file-2-web.vbs", "database-2-web.vbs" (reads a text file or database and submits the content to a website)

Q: How do I make the macro continue (and not stop), if somewhere in the macro I get a timeout or error?

Please add the command SET !ERRORIGNORE YES to your macro.

Q: How can I do calculations in a macro?

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.

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.

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.

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.

More information about VBS files can be found in our online Windows Scripting Host tutorial or in this manual.

Q: How do I link several macros together or run one after the other?

There are several method to combine different macros.

Copy & Paste
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.

Batch files
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.

Scripting Interface
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.

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?

You can add the 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.

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.

You can use variables to select a radio button. For example, instead of using one of these three lines:

and set {{choice}} to either "yes", "no" or "maybe". Please note that this value might be case sensitive. This depends on the website that processes this input.

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.

Q: How to display the content of a variable?

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

PROMPT {{!COL2}} {{!VAR1}} {{MY_VARIABLE}}

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 {{!COL2}} as dialog box text and the value of {{MY_VARIABLE}} as input box default value. This allows you to check if these variables are populated correctly.

Q: How to add missing steps?

Q: How to scroll down a page?

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:

URL GOTO=javascript:window.scrollBy(0,20000)

Just change the y (and/or x) values to whatever you need!

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:

Q: Can a macro start another macro?

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.

Q: How to create nested loops?

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.

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:

Q: How to pass values from one macro to the next?

Q: How do I avoid following a link or "clicking" a button using the TAG command?

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.

Q: How do I click a button on the browser toolbar, select a browser menu item, or interact with another browser plug-in?

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.

Q: How can I tag an element in a frame if the frame number is different each time?

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?

Q: How can I prevent my Player-only users from editing macros?

It is possible to prevent users from editing macros by using the macro encryption functionality built into the iMacros Enterprise Edition.

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.

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.

Q: Why are the image validation commands not working for an embedded Java application?

Issues during Replay

Q: Does iMacros work with every web site?

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 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 know. We are very interested to hear of such cases and will assist you in finding a solution.

Q: Can a macro recorded in one browser be played in a different browser?

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.

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.

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?

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.

Q: Does the macro script wait for the page to fully finish loading?

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.

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,....).

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?

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:

SET !TIMEOUT_PAGE 1
SET !ERRORIGNORE YES
URL GOTO=...
' Reset values to defaults
SET !ERRORIGNORE NO
SET !TIMEOUT_PAGE 60

Q: Why is a certain input box never recorded?

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.
Solution: Manually edit the macro and use POS=2 to reach the second element - the "To" selection in the following example.

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 WinClick to record the input.

Q: Why is the dialog "XYZ" not handled by iMacros? [XYZ can be any browser dialog, for example the print, download or save dialog]

This issue can have several causes. Here are some questions in order to diagnose this problem:

Dialog is not recognized during Recording

· 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.

· 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 contact tech support.

· 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.

· 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.

2. Dialog is recorded, but not managed during Replay

· 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.

Q: How do I make the IM Browser appear as native IE (Internet Explorer)?

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.

Q: How to authenticate at a proxy server?

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
proxy is not authenticated we get the error from proxy server .

Solution: Please make sure that you have the ONLOGIN command before the first URL GOTO= command.

Q: How do I prevent iMacros from "stealing" the focus?

Q: How to respond to a Refresh/Resend dialog?

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?

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.

Alternatively, you can pass the license key to the browser using the -key switch in the first parameter to iimOpen.

Q: What factors can cause a macro that uses DirectScreen or image recognition to fail on different machines?

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.

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 page 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.

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.

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.

Lastly, make sure the machines are as similar as possible with regard to OS, iMacros version, and version of IE installed.

Q: What does the error "Not enough storage is available to process this command" mean?

The most likely cause of this error is due to a memory leak in IE and not iMacros itself (the iMacros Browser uses the core IE components).

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 this article.

Extracting Data

Q: I use the EXTRACT command and get the message "Extraction anchor not found". What is the solution?

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.

Here are some tips on creating good extraction anchors:

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 *.

Incorrect: This anchor does not work because it contains a changing value (the dollar amount).

TAG POS=12 TYPE=TD ATTR=TXT:Price<SP>US$<SP>3.50 EXTRACT=TXT

Correct: Replaced changing part with asterisk *

TAG POS=12 TYPE=TD ATTR=TXT:* EXTRACT=TXT

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.

Experiment with the POS attribute. POS indicates which of a number instances of the same anchor on a web page should be extracted.

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.

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.

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.

Q: How do I extract information from a table with variable length and/or more than one page?

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.:

TAG POS={{mypos}} TYPE=TD ATTR=TXT:<SP>noWrap>*EUR* EXTRACT=TXT

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.

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.

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.

Here is a Visual Basic source code snippet, that shows how the different macros are used:

Function Read_Line(sFile, iline) As String
Dim sValue
Dim i As Integer
Dim bFound As Boolean
bFound = False
Open sFile For Input As #1
i = 1
Do While (Not EOF(1) And bFound = False)
Input #1, sValue
If i = iline Then bFound = True
i = i + 1
Loop
Close #1
If bFound = False Then
sValue = "ERROR"
End If
Read_Line = sValue
End Function
Public Sub Write_Line(sFile, sLine)
Open sFile For Append As #2
Print #2, sLine
Close #2
End Sub

How do I loop through multiple pages of results?

Q: How do I extract data from a hidden input field?

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 extract chapter and at the TAGs and HTML chapter.

Q: How do I extract text from a (Javascript) message box?

You only need to add:

SET !EXTRACTDIALOG YES

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".

Q: How do I extract text from a Flash applet?

Unfortunately it is not currently possible to extract text/data from a Flash application with iMacros.

Suggested workaround: Use the iMacros screenshot feature and then use this screenshot as input for an OCR program.

Q: Sometimes multiple items inside one cell are separated by <br> instead of creating individual cells for the data. How do I extract data separated with <br>?

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.

Q: How do I extract the page URL?

The URL of the current page is stored in the internal variable {{!URLCURRENT}}. You can use this value inside commands like any other variable, or extract it by assigning the value to the EXTRACT command:

SET !EXTRACTADD {{!URLCURRENT}}

Q: How do I extract the content of an Input Box?

If you already recorded a macro, check if the extraction TAG command contains the "CONTENT" parameter. If if does, delete it.

When recording, click the input box(which is recorded as a TAG command)

After recording:

Add "EXTRAXT=TXT" to this TAG

Delete the CONTENT parameter ("CONTENT=...") from this TAG

The result then looks like

TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:form1 ATTR=ID:TF2 EXTRACT=TXT

Q: How can I skip fields that may not appear on the page?

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.

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.

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.

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?

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?

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().

Disclaimer: DS, Image Recognition, and some dialogs - in particular download dialogs - may not work as expected in hidden forms.

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."

All iMacros dlls which come with the component have to be in the same folder as your application's executable.

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.

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).

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?

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.

The solution is to add the VC++ 2010 SP1 Runtime to the prerequisites of your application in Visual Studio.

Q: Do you have a 64-bit version of the component?

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.

Q: How can I deploy my application with ClickOnce?

For 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.

The files are going to be listed as application files, which you can then choose to include in the publish package.

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.

Use Add Existing Item

Choose files to publish from Application Files

Add VC++ runtime in prerequisites

Q: Can I create multiple instances of the component in my application, e.g. using threads?

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.

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 WCF, for instance. The controller can launch many parallel browsers in different threads.