Difference between revisions of "First Steps"

From iMacros
Jump to: navigation, search
m (Text replace - "PRO and Enterprise Edition" to "Standard and Enterprise Edition")
(Starting iMacros)
 
(39 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
==Starting iMacros ==
 
==Starting iMacros ==
iMacros is distributed as a browser add-on for Firefox, Chrome, and Internet Explorer. Two of the commercial editions of iMacros (Standard Edition and Enterprise Edition) also include the standalone iMacros Browser, a [[FAQ#Q: What is the functional difference between Internet Explorer with iMacros turned on, and the iMacros browser?|derivative of IE]] with a [[Browser Automation#Command Line Interface and Batch Files|command-line interface]].
+
iMacros is distributed as a browser add-on for Firefox, Chrome, and Internet Explorer, besides a standalone iMacros Browser, a [[FAQ#Q: What is the functional difference between Internet Explorer with iMacros turned on, and the iMacros browser?|derivative of IE]] with a [[Browser Automation#Command Line Interface and Batch Files|command line interface]]. (Notice that the iMacros Browser is not available in all iMacros editions. See [[Features Comparison]].)
  
This article primarily covers interaction with the iMacros Browser, however, the concepts and interface are fairly consistent among all the different versions of iMacros.  Throughout this Wiki, iMacros commands and functionality are are associated with browser icons ([[Image:IMacros-icon.png|iMacros Browser]] [[Image:Ie-icon.png|IE Plug-in]] [[Image:Ff-icon.png|Firefox]] [[Image:Cr-icon.png|Chrome]]) to designate their applicability to a particular browser.
+
This article primarily covers interaction with the iMacros Browser, however, the concepts and interface are fairly consistent among all the different versions of iMacros.  Throughout this Wiki, iMacros commands and functionality are associated with browser icons ([[Image:IMacros-icon.png|iMacros Browser]] [[Image:Ie-icon.png|IE Plug-in]] [[Image:Ff-icon.png|Firefox]] [[Image:Cr-icon.png|Chrome]]) to designate their applicability to a particular browser.
  
===Internet Explorer Plug-in===  
+
===iMacros for Internet Explorer ===  
 
After installing the software, a new iMacros icon appears on the command bar of Internet Explorer (IE).
 
After installing the software, a new iMacros icon appears on the command bar of Internet Explorer (IE).
 
[[File:IE_Tools_Menu_Cut_Out.png|right|thumb|iMacros in the IE Tools menu]]Click this icon to start iMacros.  
 
[[File:IE_Tools_Menu_Cut_Out.png|right|thumb|iMacros in the IE Tools menu]]Click this icon to start iMacros.  
  
[[Image:IE_Command_Bar_Button.png]]  
+
[[Image:IE_Command_Bar_Button.png|1600x80 px]]  
  
 
If you have already customized your IE command bar, you might need to manually add the icon or reposition it so it's visible.  Please see this relevant [[FAQ_-_Frequently_Asked_Questions#Q:_What_if_the_iMacros_icon_does_not_appear_in_the_IE_toolbar?|FAQ]] for more on how to do this.
 
If you have already customized your IE command bar, you might need to manually add the icon or reposition it so it's visible.  Please see this relevant [[FAQ_-_Frequently_Asked_Questions#Q:_What_if_the_iMacros_icon_does_not_appear_in_the_IE_toolbar?|FAQ]] for more on how to do this.
  
You can also start iMacros for IE by selecting 'iMacros Web Automation' from the IE Tools menu.
+
You can also start iMacros for IE by selecting 'iMacros Web Automation' from the IE Tools menu. Or run the program "iMacros.Sidebar.exe".
  
===The iMacros Browser (Advanced and Enterprise Editions)===
+
===The iMacros Browser===
To start the iMacros Browser, select the program from the Windows Start Menu, double-click the icon on your desktop, or navigate to the file "imacros.exe" (typically in C:\Program Files\iOpus\iMacros) and double-click it using Windows Explorer.  
+
To start the iMacros Browser, select the program from the Start Menu, double-click the icon on your desktop, or run the program "imacros.exe".
  
 
To become familiar with iMacros run the "FillForm" demo macro that is automatically installed. This demonstrates the basic features of iMacros in a straightforward way. It navigates to a test form, fills the form and submits it, then returns to the iMacros Website.
 
To become familiar with iMacros run the "FillForm" demo macro that is automatically installed. This demonstrates the basic features of iMacros in a straightforward way. It navigates to a test form, fills the form and submits it, then returns to the iMacros Website.
Line 21: Line 21:
 
==The iMacros Graphical User Interface ==
 
==The iMacros Graphical User Interface ==
  
We have invested a lot of effort in making the Graphical User Interface of the iMacros Browser and the Internet Explorer add-on as intuitive as possible. This section explains the basic elements. <!--The minor differences between the iMacros Browser and the IE add-on will be pointed out as necessary.-->
+
We have invested a lot of effort in making the Graphical User Interface of the iMacros Browser and the iMacros for Internet Explorer as intuitive as possible. This section explains the basic elements.
  
 
===The Main Window ===
 
===The Main Window ===
The main window consists of three parts: the menu and toolbar at the top, the iMacros sidebar on the left, and the browser window on the right. Web pages are displayed in the browser window using a tabbed interface just like other browsers. You control iMacros with the elements in the sidebar on the left.
+
The main window consists of three parts: the menu at the top, the iMacros sidebar on the left, and the browser window on the right. Web pages are displayed in the browser window using a tabbed interface just like other browsers. You control iMacros with the elements in the sidebar on the left.
  
[[File:iMacros_Browser.png|950px|center]]  
+
[[File:iMacros_Browser_FS1.png|950px|center]]  
  
 
<!--[[Image:Imacro_browser.gif|left|frame|iMacros browser]]--->
 
<!--[[Image:Imacro_browser.gif|left|frame|iMacros browser]]--->
Line 32: Line 32:
 
===The iMacros Sidebar===
 
===The iMacros Sidebar===
  
The iMacros sidebar is divided into two parts. The top half displays a tree view of all your macros when iMacros is stopped, and the current macro code when you are playing or recording a macro.  Only files with an .iim  or .iimx (obfuscated macros) extension in the Macros folder are recognized by iMacros.  The Macros folder is specified in the Path settings of the iMacros Options.  The default macro folder is located in My Documents under iMacros\Macros.
+
The iMacros sidebar is divided into two parts. The top half displays a tree view of all your macros when iMacros is stopped, and the current macro code when you are playing or recording a macro.  Only files with an .iim  or .iimx (encrypted macros) extension in the Macros folder are recognized by iMacros.  The Macros folder is specified in the Path settings.  The default macro folder is located in user Documents folder under iMacros\Macros.
  
The lower half of the sidebar consists of three tabs: Play, Record, and Edit. As the names suggest, the Play tab contains controls for playing macros, the Record tab contains controls for recording macros, and the Edit tab contains controls for editing macros, changing options, and getting help.
+
On the lower part of the sidebar, you find controls for recording, playing and editing macros, as well to change general settings and to access help.
  
[[File:Sidebar_Pin.png|left]]'''Tip:''' [[Image:IMacros-icon.png|iMacros Browser]] You can auto-hide the sidebar by "un-pinning" it from the main window (just click on the thumb-pin icon to pin or unpin the sidebar), or you can move the sidebar outside the main window to a "floating" position, or dock it on the right, if you prefer.  You can also hide the toolbar from the View menu. [[Image:Ie-icon.png|IE Plug-in]] The sidebar needs to be open in IE for iMacros to function.
 
 
<br>
 
<br>
 +
[[File:Sidebar_Pin.png|left]]'''Tip:''' [[Image:IMacros-icon.png|iMacros Browser]] You can auto-hide the sidebar by "un-pinning" it from the main window (just click on the thumb-pin icon to pin or unpin the sidebar), or you can move the sidebar outside the main window to a "floating" position, or dock it on the right, if you prefer.  You can also hide the toolbar from the View menu. [[Image:Ie-icon.png|IE Plug-in]] The sidebar needs to be open in IE for iMacros to function.
 +
<br><br>
  
 
==Recording Macros==
 
==Recording Macros==
  
===What's a Click Mode?===
+
===What's a Recording Mode?===
  
It is important to note that the primary way iMacros records your interaction with a web page is by recording your mouse clicks on the various web page elements.  iMacros records these clicks as well as text entered into input fields on web forms and translates them into [[TAG]] commands.  If you are entering and selecting values in a series of fields on a web form, you need to navigate to each field with the mouse and click into/on that field.
+
[[Image:RecordingOptionsMenu.png|300px|left]] It is important to note that the primary way iMacros records your interaction with a web page is by recording your mouse clicks on the various web page elements.  iMacros records these clicks as well as text entered into input fields on web forms and translates them into [[TAG]] commands.  If you are entering and selecting values in a series of fields on a web form, you need to navigate to each field with the mouse and click into/on that field.
  
'''Note:''' Navigating through fields with the keyboard (i.e. using the TAB key) is not supported and will not be recorded.
+
'''Note:''' Navigating through fields with the keyboard (i.e. using the TAB key) might not be recorded.
  
Before recording, it is important to understand the different modes of recording that you can use.  This is also known as the Click Mode.  The three main click modes are Automatic, Expert (Use complete HTML tag), and [[DirectScreen]]. To select a click mode, use the ClickMode menu item or open the Click Mode Dialog from the main toolbar or Record tab.
+
Before recording, it is important to understand the different modes of recording that you can use.  The main recording modes are [[TAG]] (Automatic, Expert or Complete HTML, and Selector), [[EVENT]], and [[DirectScreen]]. To select a mode, use the Recording Options menu item or open the Recording Options Window from the sidebar while recording.
  
[[File:Click_Mode_Dialog.png|right]]
+
[[File:Click_Mode_Dialog.png|center]]
  
====Automatic====
+
====Tag Automatic====
  
 
iMacros attempts to choose the best recording options (recommended in most cases for recording on HTML websites). In the automatic mode iMacros looks at the different attributes an element has (such as ID, NAME, Text, HREF, etc.) and selects the one attribute it thinks fits best (for details, please see the "[[Automatic Mode Details|For advanced users]]" description). Note that the automatic mode never switches to Expert or [[DirectScreen]] mode. If you need these recording modes, please select them manually.  
 
iMacros attempts to choose the best recording options (recommended in most cases for recording on HTML websites). In the automatic mode iMacros looks at the different attributes an element has (such as ID, NAME, Text, HREF, etc.) and selects the one attribute it thinks fits best (for details, please see the "[[Automatic Mode Details|For advanced users]]" description). Note that the automatic mode never switches to Expert or [[DirectScreen]] mode. If you need these recording modes, please select them manually.  
  
====Expert====
+
====Tag Expert (Complete HTML)====
  
 
This mode is for advanced users: iMacros does not select just ''one'' attribute as in the automatic mode, but instead creates a [[TAG]] command that consists of ''all'' attributes of the clicked HTML element. The purpose is to give the user a quick overview of all of the element's attributes. Typically the user will use such a [[TAG]] command as a starting point, and then delete the attributes that should not be used. Often this is more convenient than [[TAGs_and_HTML|building such a TAG command manually]].
 
This mode is for advanced users: iMacros does not select just ''one'' attribute as in the automatic mode, but instead creates a [[TAG]] command that consists of ''all'' attributes of the clicked HTML element. The purpose is to give the user a quick overview of all of the element's attributes. Typically the user will use such a [[TAG]] command as a starting point, and then delete the attributes that should not be used. Often this is more convenient than [[TAGs_and_HTML|building such a TAG command manually]].
  
====X/Y [[Image:Ff-icon.png|Firefox]]====
+
====Tag Selector====
iMacros for Firefox provides this mode for identifying elements by their position on the web page. This can be useful if the name and URL of the item you want to click on changes dynamically from visit to visit. It should also be used if the web page element is embedded in JavaScript and iMacros can not find the recorded name during replay because it was created "on the fly" by JavaScript. For more information on this mode, see the [[CLICK]] command.
+
 
 +
In this mode a [[TAG]] command is built using the CSS Selector for the element, by default using its id. You can disable the checkbox "Prefer element ids in selectors" to force iMacros for using another attribute. Modern websites rely heavily in CSS selectors and unique ids, so this mode will work well in such modern webpages.
 +
 
 +
====Event====
 +
 
 +
[[EVENT]] is a relatively new recording mode to automate web controls that the classic [[TAG]] command can not automate:
 +
 
 +
* Drag & Drop
 +
* Sliders
 +
* Tricky date control
 +
* Dynamic drop-down boxes 
 +
 
 +
The [[EVENT]] and EVENTS commands can make use of CSS selectors and XPATH expressions for targeting elements on the page. In addition to clicking elements, these commands can also send mouse and keyboard events to Javascript-rich pages.
  
 
====DirectScreen====
 
====DirectScreen====
  
This is the ultimate solution if everything else fails. It simulates standard mouse clicks and movement within the browser window. This feature works with all web pages. For non-html elements such as Flash or Silverlight, you must use the [[DirectScreen]] mode.  DirectScreen is only available in the iMacros Browser and iMacros for IE commercial editions.
+
This is the ultimate solution if everything else fails. It simulates standard mouse clicks and movement within the browser window. This feature works with all web pages. For non-html elements such as Flash or Silverlight, you must use the [[DirectScreen]] mode.  DirectScreen is not available in all iMacros Editions, see the [[Features Comparison]] for which editions support it.
 +
 
 +
====X/Y [[Image:Ff-icon.png|Firefox]]====
 +
iMacros for Firefox provides this mode for identifying elements by their position on the web page. This can be useful if the name and URL of the item you want to click on changes dynamically from visit to visit. It should also be used if the web page element is embedded in JavaScript and iMacros can not find the recorded name during replay because it was created "on the fly" by JavaScript. For more information on this mode, see the [[CLICK]] command.
  
 
====Changing Modes====
 
====Changing Modes====
  
[[File:Show_Click_Mode_Dialog_Button.png|none]]
+
[[File:Show_Click_Mode_Dialog_Button.png|none]]
  
In most cases you will record your macros using just one click mode, but you aren't limited to just one click mode per macro.  In fact, you can mix the modes in a single macro by changing the click mode while you are recording!  This is useful if you encounter problems while attempting to record one or more elements on a web page: simply switch to a different click mode and try clicking the element again.
+
In most cases you will record your macros using just one recording mode, but you aren't limited to just one mode per macro.  In fact, you can mix the modes in a single macro by changing the click mode while you are recording!  This is useful if you encounter problems while attempting to record one or more elements on a web page: simply switch to a different mode and try clicking the element again.
  
You may also have to change click modes if you notice that your recorded commands are not playing back successfully.  In this case try selecting a different click mode and re-record your macro.
+
You may also have to change recording modes if you notice that your recorded commands are not playing back successfully.  In this case try selecting a different mode and re-record your macro.
 +
 
 +
=== Image Validation ===
 +
 
 +
Image validation (the [[IMAGECLICK]] and [[IMAGESEARCH]] commands)''' combines the power of [[DirectScreen]] with computer vision'''. To use it, open the Image Validation Wizard. For more details please see [[Image Validation]]. [[Image Validation]] is not available in all iMacros editions, see [[Features Comparison]].
 +
 
 +
 
 +
[[File:Image recognition wizard.png|thumb|center|700px|Image Validation Wizard: Use it to create the [[IMAGECLICK]] and [[IMAGESEARCH]] commands.]]
  
 
===To record a macro===
 
===To record a macro===
Line 79: Line 102:
  
 
To start recording a macro, select one of the following methods:
 
To start recording a macro, select one of the following methods:
* Click the "Record" button on the Record tab of the iMacros sidebar
+
* Click the "Record" button on the iMacros sidebar
* Click the "Record" button on the toolbar.
+
 
* Press Ctrl+F5.
 
* Press Ctrl+F5.
  
 
Now simply perform whatever tasks you wish to record, such as surfing to web sites, filling out forms, making a test order on your e-commerce site or any other task of your choosing.
 
Now simply perform whatever tasks you wish to record, such as surfing to web sites, filling out forms, making a test order on your e-commerce site or any other task of your choosing.
  
After you have finished recording press "Stop". The current recording is automatically saved as a macro named "#Current". Press "Save Macro As..." to save it as a different name, or right-click the macro in the macro list and select "Rename".
+
After you have finished recording press "Stop". The current recording is automatically saved with the [[Default Macro Name]].
  
 
===Hints for successful recording===
 
===Hints for successful recording===
 
* Select elements to record by clicking them with the mouse (don't use the TAB key to navigate through fields).
 
* Select elements to record by clicking them with the mouse (don't use the TAB key to navigate through fields).
* During recording do not use your browser's Back or Forward button or change the address line. Use the buttons supplied by iMacros instead (iMacros Browser and IE add-on only).
+
* Recording "Clicks". '''If a macro generates an error during replay you can experiment by selecting [[DirectScreen]] as recording mode
* Recording "Clicks". '''If a macro generates an error during replay you can experiment by selecting the link recording option (''Click Mode'') manually from the dialog after clicking ''Click Mode''.'''
+
* Because the iMacros recording language is [[Command_Reference#iMacros_Commands_Reference|fully documented]] it is easy to edit and "tweak" the macro manually after recording!  
* Because the iMacros recording language is [[Command_Reference#iMacros_Commands_Reference|fully documented]] it is easy to edit and "tweak" the macro manually after recording!
+
* The iMacros Standard and Enterprise Edition licenses include [http://www.iopus.com/service/support/options.htm free Silver Level tech support], so our support team is ready to help you with your project and any recording issues that you might encounter.
+
  
 
Related animated tutorial: [[Tutorials#Recording_a_Macro|Recording a macro]]
 
Related animated tutorial: [[Tutorials#Recording_a_Macro|Recording a macro]]
 
'''Note:''' The relationship between a recorded [[TAG]] command and the actual web page HTML code is [[TAGs_and_HTML|fully documented]]. There is also an [http://www.iopus.com/imacros/support/html2tag.htm example page] to test the iMacros recording. Advanced users can use this documentation to manually created [[TAG]] commands based on the HTML source of the website and/or have a program generate the iMacros macro commands.
 
  
 
==Playing Macros==
 
==Playing Macros==
Line 102: Line 120:
 
[[Image:Play_Toolbar_Button.png|none]]  
 
[[Image:Play_Toolbar_Button.png|none]]  
 
To play a macro, first select the macro in the macro list and then choose one of the following methods:  
 
To play a macro, first select the macro in the macro list and then choose one of the following methods:  
* Click the "Play" button on the toolbar.
+
[[Image:Play_Loop.png|frame]]
* Click the "Play" button or on the Play tab of the sidebar.
+
* Click the "Play" button or on the sidebar.
 
* Simply double-click the macro in the list.
 
* Simply double-click the macro in the list.
 
* Press the F5 key.
 
* Press the F5 key.
  
During playback a blue frame shows you which parts of the web page are being manipulated. To play a recorded sequence multiple times, fill in the Max. number of times to repeat the macro and press the "Play (Loop)" button.[[Image:Play_Loop.png|frame]]
+
During playback a blue frame shows you which parts of the web page are being manipulated. To play a recorded sequence multiple times, fill in the mximum number of times to repeat the macro and press the "Play" button.
  
 
===Controlling playback speed===
 
===Controlling playback speed===
There are two different options that affect the speed at which macros are replayed. These can be set in the General tab of the Options dialog as well as within the macro with the [[!REPLAYSPEED]] variable.  
+
[[Image:Playbackdelay.png|200px|left]]
 +
There are two different options that affect the speed at which macros are replayed. These can be set in iMacros Settings as well as within the macro with the [[!PLAYBACKDELAY]] variable.  
  
The first option is the replay speed, which can be set to three different values:  
+
The delay can be set to any value in seconds, but in the settings window, the maximum is 2s. Clicking on the labels fast, slow and fast is a quick way to set the value to their fixed delays:
* FAST: the macro is replayed at maximum speed (Recommended in most cases).  
+
* FAST: the macro is replayed at maximum speed = no delay  
* MEDIUM: iMacros waits for 0.25s between each command
+
* MEDIUM: iMacros waits for 1 second between each command  
* SLOW: iMacros waits for 1s between each command
+
* SLOW: iMacros waits for 2 seconds between each command
 
   
 
   
The second option is to add timing information during recording ([[DirectScreen]] [[#What's a Click Mode?|click-mode]] only). If the "Add timing information" checkbox is checked in the Click Mode Dialog, then [[WAIT]] statements are automatically included in the macro. Thus, during replay these WAIT statements slow down the macro playback.  
+
The second option is to add timing information during recording ([[DirectScreen]] [[#What's a Click Mode?|click-mode]] only). If the "Add timing information" checkbox is checked in the Recording Options window, then [[WAIT]] statements are automatically included in the macro. Thus, during replay these WAIT statements slow down the macro playback.  
  
 
Of course, you can also always manually add [[WAIT]] statements to your macro to further control the speed.
 
Of course, you can also always manually add [[WAIT]] statements to your macro to further control the speed.
Line 125: Line 144:
  
 
'''Related forum posts:'''
 
'''Related forum posts:'''
*[http://forum.iopus.com/viewtopic.php?f=15&t=5770 Editing a macro when automated recording fails]
+
*[http://forum.imacros.net/viewtopic.php?f=15&t=5770 Editing a macro when automated recording fails]
*[http://forum.iopus.com/viewtopic.php?f=15&t=5744 Automating Google Maps]
+
*[http://forum.imacros.net/viewtopic.php?f=15&t=5744 Automating Google Maps]
  
 
'''See also:'''
 
'''See also:'''
Line 141: Line 160:
 
(Related example macro: [[Demo-FillForm|FillForm]])
 
(Related example macro: [[Demo-FillForm|FillForm]])
  
All recorded macros are stored as a plain text file with the an .iim extension in the folder specified by the "Folder Macros" setting on the Path tab of the Options dialog. The default macro folder is located in My Documents under iMacros\Macros.   
+
All recorded macros are stored as a plain text file with the .iim extension in the folder specified by the "Folder Macros" setting on the Path tab of the Options dialog. The default macro folder is located in My Documents under iMacros\Macros.   
  
You can manually edit and tweak the macros using any text editor you like, for example Notepad, which is shipped with the Windows operating system by default.
+
You can manually edit and tweak the macros using any text editor you like. iMacros comes with a dedicated editor designed specially for macros.
 
   
 
   
To open a macro, first select the macro in the macro list and then choose one of the following methods:
+
To edit a macro, first select the macro in the macro list and then choose one of the following methods:
* Click the "Edit Macro" button on the toolbar.
+
* Click the "Edit" button on the sidebar.
* Click the "Edit Macro" button on the Edit tab of the sidebar.
+
 
* Right-click the macro in the list and select "Edit macro".
 
* Right-click the macro in the list and select "Edit macro".
 
* Press the F9 key.
 
* Press the F9 key.
  
The editor specified by the "External editor" setting on the Path tab of the Options dialog ([[Editor|iMacrosEditor]] by default) will open and display the macro - in this example we chose the FillForm demo macro:  
+
By default, iMacros will use the iMacros [[Editor]], but you can choose another one in the "External editor" setting on the Path tab of the Settings dialog. The editor will open and display the macro - in this example we chose the FillForm demo macro:  
  
[[Image:iMacrosEditor.png]]  
+
[[Image:iMacrosEditor_FS1.png|800 px]]  
  
 
As a simple edit step, let's change the content of a form text field now. To change the Name below from "Tom Tester" to "Dr. A. Award" locate the TAG command that contains "Tom Tester" and change is as shown below:  
 
As a simple edit step, let's change the content of a form text field now. To change the Name below from "Tom Tester" to "Dr. A. Award" locate the TAG command that contains "Tom Tester" and change is as shown below:  
Line 163: Line 181:
 
If the value of the [[TAG#Parameters|CONTENT]] parameter contains spaces, you must either:
 
If the value of the [[TAG#Parameters|CONTENT]] parameter contains spaces, you must either:
 
* Enclose the value in double-quotes
 
* Enclose the value in double-quotes
* Replace all spaces in the text with <SP> and substitute all newlines with <nowiki><BR></nowiki>, e.g. CONTENT=Dr.<SP>A.<SP>Award. ([http://forum.iopus.com/viewtopic.php?f=2&t=4516 Related forum post]).  
+
* Replace all spaces in the text with <SP> and substitute all newlines with <nowiki><BR></nowiki>, e.g. CONTENT=Dr.<SP>A.<SP>Award. ([http://forum.imacros.net/viewtopic.php?f=2&t=4516 Related forum post]).  
 
After you save the changes to the file, iMacros will immediately apply them during the next replay of the macro.
 
After you save the changes to the file, iMacros will immediately apply them during the next replay of the macro.
  
<!--'''Tip:''' We recommend [http://forum.iopus.com/viewtopic.php?f=2&t=4828 installing] and using the free Notepad++ editor. It not only has better features such as line numbering, but it also supports '''[http://forum.iopus.com/viewtopic.php?f=2&t=4828 iMacros syntax highlighting]'''.
+
<!--'''Tip:''' We recommend [http://forum.imacros.net/viewtopic.php?f=2&t=4828 installing] and using the free Notepad++ editor. It not only has better features such as line numbering, but it also supports '''[http://forum.imacros.net/viewtopic.php?f=2&t=4828 iMacros syntax highlighting]'''.
 
[[Image:Notepad_plus_plus.png‎|thumb|center|800px|Notepad++ Editor with iMacros syntax highlighting for *.iim files]]
 
[[Image:Notepad_plus_plus.png‎|thumb|center|800px|Notepad++ Editor with iMacros syntax highlighting for *.iim files]]
  

Latest revision as of 10:04, 13 October 2017

Starting iMacros

iMacros is distributed as a browser add-on for Firefox, Chrome, and Internet Explorer, besides a standalone iMacros Browser, a derivative of IE with a command line interface. (Notice that the iMacros Browser is not available in all iMacros editions. See Features Comparison.)

This article primarily covers interaction with the iMacros Browser, however, the concepts and interface are fairly consistent among all the different versions of iMacros. Throughout this Wiki, iMacros commands and functionality are associated with browser icons (iMacros Browser IE Plug-in Firefox Chrome) to designate their applicability to a particular browser.

iMacros for Internet Explorer

After installing the software, a new iMacros icon appears on the command bar of Internet Explorer (IE).

iMacros in the IE Tools menu
Click this icon to start iMacros.

IE Command Bar Button.png

If you have already customized your IE command bar, you might need to manually add the icon or reposition it so it's visible. Please see this relevant FAQ for more on how to do this.

You can also start iMacros for IE by selecting 'iMacros Web Automation' from the IE Tools menu. Or run the program "iMacros.Sidebar.exe".

The iMacros Browser

To start the iMacros Browser, select the program from the Start Menu, double-click the icon on your desktop, or run the program "imacros.exe".

To become familiar with iMacros run the "FillForm" demo macro that is automatically installed. This demonstrates the basic features of iMacros in a straightforward way. It navigates to a test form, fills the form and submits it, then returns to the iMacros Website.

The iMacros Graphical User Interface

We have invested a lot of effort in making the Graphical User Interface of the iMacros Browser and the iMacros for Internet Explorer as intuitive as possible. This section explains the basic elements.

The Main Window

The main window consists of three parts: the menu at the top, the iMacros sidebar on the left, and the browser window on the right. Web pages are displayed in the browser window using a tabbed interface just like other browsers. You control iMacros with the elements in the sidebar on the left.

iMacros Browser FS1.png


The iMacros Sidebar

The iMacros sidebar is divided into two parts. The top half displays a tree view of all your macros when iMacros is stopped, and the current macro code when you are playing or recording a macro. Only files with an .iim or .iimx (encrypted macros) extension in the Macros folder are recognized by iMacros. The Macros folder is specified in the Path settings. The default macro folder is located in user Documents folder under iMacros\Macros.

On the lower part of the sidebar, you find controls for recording, playing and editing macros, as well to change general settings and to access help.


Sidebar Pin.png
Tip: iMacros Browser You can auto-hide the sidebar by "un-pinning" it from the main window (just click on the thumb-pin icon to pin or unpin the sidebar), or you can move the sidebar outside the main window to a "floating" position, or dock it on the right, if you prefer. You can also hide the toolbar from the View menu. IE Plug-in The sidebar needs to be open in IE for iMacros to function.



Recording Macros

What's a Recording Mode?

RecordingOptionsMenu.png
It is important to note that the primary way iMacros records your interaction with a web page is by recording your mouse clicks on the various web page elements. iMacros records these clicks as well as text entered into input fields on web forms and translates them into TAG commands. If you are entering and selecting values in a series of fields on a web form, you need to navigate to each field with the mouse and click into/on that field.

Note: Navigating through fields with the keyboard (i.e. using the TAB key) might not be recorded.

Before recording, it is important to understand the different modes of recording that you can use. The main recording modes are TAG (Automatic, Expert or Complete HTML, and Selector), EVENT, and DirectScreen. To select a mode, use the Recording Options menu item or open the Recording Options Window from the sidebar while recording.

Click Mode Dialog.png

Tag Automatic

iMacros attempts to choose the best recording options (recommended in most cases for recording on HTML websites). In the automatic mode iMacros looks at the different attributes an element has (such as ID, NAME, Text, HREF, etc.) and selects the one attribute it thinks fits best (for details, please see the "For advanced users" description). Note that the automatic mode never switches to Expert or DirectScreen mode. If you need these recording modes, please select them manually.

Tag Expert (Complete HTML)

This mode is for advanced users: iMacros does not select just one attribute as in the automatic mode, but instead creates a TAG command that consists of all attributes of the clicked HTML element. The purpose is to give the user a quick overview of all of the element's attributes. Typically the user will use such a TAG command as a starting point, and then delete the attributes that should not be used. Often this is more convenient than building such a TAG command manually.

Tag Selector

In this mode a TAG command is built using the CSS Selector for the element, by default using its id. You can disable the checkbox "Prefer element ids in selectors" to force iMacros for using another attribute. Modern websites rely heavily in CSS selectors and unique ids, so this mode will work well in such modern webpages.

Event

EVENT is a relatively new recording mode to automate web controls that the classic TAG command can not automate:

  • Drag & Drop
  • Sliders
  • Tricky date control
  • Dynamic drop-down boxes

The EVENT and EVENTS commands can make use of CSS selectors and XPATH expressions for targeting elements on the page. In addition to clicking elements, these commands can also send mouse and keyboard events to Javascript-rich pages.

DirectScreen

This is the ultimate solution if everything else fails. It simulates standard mouse clicks and movement within the browser window. This feature works with all web pages. For non-html elements such as Flash or Silverlight, you must use the DirectScreen mode. DirectScreen is not available in all iMacros Editions, see the Features Comparison for which editions support it.

X/Y Firefox

iMacros for Firefox provides this mode for identifying elements by their position on the web page. This can be useful if the name and URL of the item you want to click on changes dynamically from visit to visit. It should also be used if the web page element is embedded in JavaScript and iMacros can not find the recorded name during replay because it was created "on the fly" by JavaScript. For more information on this mode, see the CLICK command.

Changing Modes

Show Click Mode Dialog Button.png

In most cases you will record your macros using just one recording mode, but you aren't limited to just one mode per macro. In fact, you can mix the modes in a single macro by changing the click mode while you are recording! This is useful if you encounter problems while attempting to record one or more elements on a web page: simply switch to a different mode and try clicking the element again.

You may also have to change recording modes if you notice that your recorded commands are not playing back successfully. In this case try selecting a different mode and re-record your macro.

Image Validation

Image validation (the IMAGECLICK and IMAGESEARCH commands) combines the power of DirectScreen with computer vision. To use it, open the Image Validation Wizard. For more details please see Image Validation. Image Validation is not available in all iMacros editions, see Features Comparison.


Image Validation Wizard: Use it to create the IMAGECLICK and IMAGESEARCH commands.

To record a macro

Record Button.png

To start recording a macro, select one of the following methods:

  • Click the "Record" button on the iMacros sidebar
  • Press Ctrl+F5.

Now simply perform whatever tasks you wish to record, such as surfing to web sites, filling out forms, making a test order on your e-commerce site or any other task of your choosing.

After you have finished recording press "Stop". The current recording is automatically saved with the Default Macro Name.

Hints for successful recording

  • Select elements to record by clicking them with the mouse (don't use the TAB key to navigate through fields).
  • Recording "Clicks". If a macro generates an error during replay you can experiment by selecting DirectScreen as recording mode
  • Because the iMacros recording language is fully documented it is easy to edit and "tweak" the macro manually after recording!

Related animated tutorial: Recording a macro

Playing Macros

Play Toolbar Button.png

To play a macro, first select the macro in the macro list and then choose one of the following methods:

Play Loop.png
  • Click the "Play" button or on the sidebar.
  • Simply double-click the macro in the list.
  • Press the F5 key.

During playback a blue frame shows you which parts of the web page are being manipulated. To play a recorded sequence multiple times, fill in the mximum number of times to repeat the macro and press the "Play" button.

Controlling playback speed

Playbackdelay.png

There are two different options that affect the speed at which macros are replayed. These can be set in iMacros Settings as well as within the macro with the !PLAYBACKDELAY variable.

The delay can be set to any value in seconds, but in the settings window, the maximum is 2s. Clicking on the labels fast, slow and fast is a quick way to set the value to their fixed delays:

  • FAST: the macro is replayed at maximum speed = no delay
  • MEDIUM: iMacros waits for 1 second between each command
  • SLOW: iMacros waits for 2 seconds between each command

The second option is to add timing information during recording (DirectScreen click-mode only). If the "Add timing information" checkbox is checked in the Recording Options window, then WAIT statements are automatically included in the macro. Thus, during replay these WAIT statements slow down the macro playback.

Of course, you can also always manually add WAIT statements to your macro to further control the speed.

Errors during replay

We work hard to make iMacros as "intelligent" as possible, but it still is not as smart as you. If an error occurs during replay it is mostly due to a "tricky" web page in which one of the automatic suggestions of the iMacros Recorder failed. In almost all cases re-recording the macro with different settings or manually editing the macro solves the problem. For recording tips please see the Recording section and for information on how to edit your macro go to the Editing Macros section.

Related forum posts:

See also:

Tip: If you want to prevent the blue frame from being drawn around tagged elements during playback, add the following statement to your macro:

SET !MARKOBJECT NO

Editing Macros

Edit Macro Button.png

(Related example macro: FillForm)

All recorded macros are stored as a plain text file with the .iim extension in the folder specified by the "Folder Macros" setting on the Path tab of the Options dialog. The default macro folder is located in My Documents under iMacros\Macros.

You can manually edit and tweak the macros using any text editor you like. iMacros comes with a dedicated editor designed specially for macros.

To edit a macro, first select the macro in the macro list and then choose one of the following methods:

  • Click the "Edit" button on the sidebar.
  • Right-click the macro in the list and select "Edit macro".
  • Press the F9 key.

By default, iMacros will use the iMacros Editor, but you can choose another one in the "External editor" setting on the Path tab of the Settings dialog. The editor will open and display the macro - in this example we chose the FillForm demo macro:

iMacrosEditor FS1.png

As a simple edit step, let's change the content of a form text field now. To change the Name below from "Tom Tester" to "Dr. A. Award" locate the TAG command that contains "Tom Tester" and change is as shown below:

Old:

TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f1 ATTR=NAME:n1 CONTENT="Tom Tester"   

New:

TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f1 ATTR=NAME:n1 CONTENT="Dr. A. Award" 

If the value of the CONTENT parameter contains spaces, you must either:

  • Enclose the value in double-quotes
  • Replace all spaces in the text with <SP> and substitute all newlines with <BR>, e.g. CONTENT=Dr.<SP>A.<SP>Award. (Related forum post).

After you save the changes to the file, iMacros will immediately apply them during the next replay of the macro.


Next Steps