Webextensions

From iMacros
Jump to: navigation, search

License

iMacros End User License Agreement

Installation Chrome Firefox

The information here pertains to iMacros for Chrome and Firefox specifically.

Download and install the latest version of the iMacros extension from the respective browser web store. No administrative rights are required for the installation.

The extension corresponds to the free version, which can be used for non-commercial purposes to record and replay small macros stored as bookmarks. Some iMacros features are only available with a Personal Edition (or higher) license. This includes file access to play macro files, read/write CSV files, and other extended functionality as detailed in the table below:

Feature Free edition Paid version (any) Affected commands
Play macros Only as bookmarks, up to 50 lines. As bookmarks and files, any length
Record macros Only as bookmarks, up to 50 lines As bookmarks and files, any length
Save macros Only as bookmarks As bookmarks and files
Read input from CSV files No Yes !DATASOURCE
Save extracted data to file No Yes SAVEAS, SAVEITEM
Make screenshots of webpage No Yes SCREENSHOT, SAVEAS
Save stopwatch data to a file No. Data can still be referenced in macro via the !STOPWATCHTIME variable Yes !FILESTOPWATCH, !FOLDER_STOPWATCH
Profile macro performance No Yes !FILE_PROFILER

If you want to use iMacros in your business or would like to store macros as regular text files to exchange them across other versions of iMacros (Chrome, Firefox, iMacros Browser, iMacros for IE), read/write CSV files, and other extended functionality, you will need iMacros File Access. Purchase any iMacros license and download the latest File Access for iMacros Extensions module from your Ipswitch account. Current iMacros customers with an active service agreement already have access to this module.

Add File Access

How iMacros for Chrome and iMacros for Firefox look when the file access module is not installed. Once it is installed, you will see the familiar treeview there.

Important:

  1. iMacros File Access is only available for Windows. Currently we do not offer a version for Mac or Linux.
  2. Only a license for Personal, Professional, or Enterprise v12 or later will work

Download the installer from your Ipswitch Community account

  • Login to your account
  • Select My Products
  • Select your license
  • Click the Download link to download the installer for the File Access module.
  • After installing, the File Access module will automatically detect whether there is an iMacros license on the machine and only prompt you to enter your activation code if necessary
  • Please also read ScriptingInterface.readme.txt located in %localappdata%\Programs\iMacros after installing File Access!
Download from Ipswitch Community account

Trouble Activating

If you encounter any errors or have any issues activating the license, please submit a new Account/Access Question using this form. Specify "Help activating iMacros Personal Edition license" as the subject and provide the serial number for your license in the problem description.

First Steps

After you installed the iMacros extension in your browser you will see the iMacros icon in the toolbar, which is used to open the iMacros sidebar. First we recommend that you look at a few demo macros. After this start recording your own first macro. To get started, a simple website like this wiki or our company website are good. To record, open the iMacros panel and click record. When you are done recording, click the stop icon either in the panel or in the browser toolbar. The iMacros icon changes to a stop button with line counter during recording and replay. You can then playback the macro or view/edit the macro code.

The iMacros for Chrome Panel: You can start playing macros either from the iMacros panel or from your bookmarks or macros that are embedded into websites.
The iMacros icon changes to a stop button with line counter during recording and replay, or a play button when paused. The WAIT command displays the wait time as countdown.

The iMacros panel has a play loop button to run macros repeatedly. This can be useful for checking a certain web page status or for web testing. While the loop is running, the current loop number is stored in the !LOOP internal variable.

Example usage: Create a macro that refreshes the current page every 5 seconds:

 VERSION BUILD=1031208
 REFRESH
 WAIT SECONDS=5
Start the PAGE REFRESH macro with the LOOP button.

Spend some time to get familiar with this wiki, it has lots of in-depth information on all iMacros functionality, as well as have a look at the Resources page on the iMacros website.

Tips for using iMacros browser extensions freeware

Some of iMacros functionality is now only available with a paid license. These are features we believe are most likely to be used in a business environment and should not affect hobby users of iMacros.

Because we think there is still a lot of value in the freeware, we would like to give you a few tips to overcome some of the limitations, if you would like to keep using the freeware for your personal tasks.

  1. Existing macro files can easily be copied to bookmarks through the clipboard: open the macro file in any text editor, copy its contents to the clipboard and paste over an existing bookmark macro which is open in the macro editor. If you do not have any bookmark macro, start recording to create one. Use SaveAs to save with a new name.
  2. Long macros can be divided in smaller chunks and played one after the other. Just be aware that variables and macro settings are reset after each play.
  3. Besides the 3 user variables (!VAR1, !VAR2, and !VAR3), the !EXTRACT macro variable can also be used to "park" values. Or one can make use of an auxiliary html file loaded in another tab. A dummy form like in http://demo.imacros.net/Automate/AutoDataEntry might be all you need.
  4. To input data from CSV files, use an html file with a table where your data is displayed on a browser tab, see below. Tag the table elements from that tab instead of reading from a file. Excel can save a worksheet (an imported CSV file) to html.

 <html>
 <head>
   <style>
       .table
       {
           width: 100%
       }
       .row .cell
       {
           padding: 5px;            
           border: 1px solid black;
       }
       
   </style>
   <script>
       window.onload = function () {
           var datasource = document.getElementById('datasource');
           datasource.addEventListener('change', function (e) {
               var csvFile = datasource.files[0];
               var fileReader = new FileReader();
               fileReader.onloadend = function (e) {
                   var table = document.getElementById('table');
                   var lines = fileReader.result.split(/\r?\n/);
                   var n = 0;
                   lines.forEach(function (line) {
                       n++;
                       var tr = document.createElement("tr");
                       tr.setAttribute("class", "row");
                       tr.setAttribute("id", "row_" + n);
                       var cells = line.split(/,/);
                       var m = 0;
                       cells.forEach(function (cell) {
                           var td = document.createElement("td");
                           m++;
                           td.setAttribute("id", "cell_" + n + "-" + m);
                           td.setAttribute("class", "cell");
                           var text = document.createTextNode(cell);
                           td.appendChild(text);
                           tr.appendChild(td);
                       });
                       table.appendChild(tr);
                   });
               }
               fileReader.readAsText(csvFile);
           }, false);
       }
   </script>
 </head>
 <body>
    Select CSV file:
    <input type="file" id="datasource" />
    <div>Table with loaded CSV file:</div>
    <table id="table" class=table></table>
 </body>
 </html>

iMacros as Bookmarklets

You can rename, edit or delete your iMacros via your browser's bookmark manager


If you are used to other iMacros versions, you might be surprised that iMacros for Chrome and iMacros for Firefox do not store its macros as text files. The reason for this is that web extensions can not access the file system. Instead we store macros as bookmarklets inside the regular browser bookmarking system.

As the macros are packed as bookmarklets, you can just drag & drop them to your bookmarks folder or bookmarks bar. This means you can take full advantage of Chrome and Firefox syncing to have your macros synced across computers. You can sync your iMacros macros just like normal bookmarks. And with the iMacros secure password encryption that means that you can even store login macros securely in the cloud.


Social Scripting

Users can embed the complete macro in a simple link that can be shared with friends and coworkers. Users can also embed the link on their homepage, blog and company Intranet. In this way, users can help website visitors perform certain tasks. Instead of telling visitors how to fill out a form, users can let iMacros fill out the form for them. All information is stored inside the link as a text string, and nothing is stored on our servers.

For example, click on this link to search for available flights at orbitz.

Important: Make sure the embedded macro is url-encoded using e.g. this tool.

Tip: To send macros (bookmarklets) by email, use the a link shortener service.

Command Line Support

Neither Firefox Quantum, nor Chrome provide command line information for extensions, but user "cammarin" suggested a great way to use iMacros via the command line: Embed the iMacros bookmarklet in a local web page.

  1. Chrome only: Make sure that "Allow access to file URLs" is enabled for the iMacros extension as shown here.
  2. Create a bookmark for the macro you want to launch
  3. Right-click on the bookmark in the browser (not in the iMacros sidebar) and select Edit
  4. In the URL field, copy the value of the e_m64 variable, e.g. everything between quotes where you see: var e_m64 = "..."
  5. Paste this value in place of the corresponding value for var e_m64 in the HTML file shown below

Example:

 <html>
     <body onload="window.setTimeout('document.getElementById(\'criimlaunch\').click();', 1000);">

        <script>
           var e_m64 = "UFJPTVBUJTIwSEVMTE8hJTBBVVJMJTIwR09UTyUzRGh0dHAlM0ElMkYlMkZpbWFjcm9zLm5ldCUyRiUwQVBST01QVCUyMEJZRSE";
        </script>

        <a id="criimlaunch" href="javascript:(function() {try{if(!/^(?:chrome|https?|file)/.test(location)){alert('iMacros: Open webpage to run a macro.');return;}
           var macro = {};macro.source = decodeURIComponent(atob(e_m64));macro.name = 'MacroBookmarklet';
           var evt = document.createEvent('CustomEvent');evt.initCustomEvent('iMacrosRunMacro', true, true, macro);
           window.dispatchEvent(evt);}catch(e){alert('iMacros Bookmarklet error: '+e.toString());}}) ();">Launch iMacros</a>

     </body>
 </html>

Example command line / batch file:

 "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" file:///D:/web/test.htm

"test.htm" is the local webpage with the bookmarklet.

Alternatively, you can embed the macro source code directly into the HTML file and skip the process of creating a macro bookmark altogether (special thanks to forum user iimfun for this solution!):

<html>
   <body onload="window.setTimeout('document.getElementById(\'criimlaunch\').click();', 1000);">

      <script>
         var macroCode = '';
         macroCode += 'PROMPT HELLO!\n';
         macroCode += 'URL GOTO=http://imacros.net/\n';
         macroCode += 'PROMPT BYE!\n';

         function launchMacro()
            {
            try
               {
                  if(!/^(?:chrome|https?|file)/.test(location))
                  {
                     alert('iMacros: Open webpage to run a macro.');
                     return;
                  }
			   
                  var macro = {}; 
                  macro.source = macroCode;
                  macro.name = 'EmbeddedMacro';
			   
                  var evt = document.createEvent('CustomEvent');
                  evt.initCustomEvent('iMacrosRunMacro', true, true, macro);
                  window.dispatchEvent(evt);
               }
            catch(e)
            {
               alert('iMacros Bookmarklet error: '+e.toString());
            };
         }
      </script>

      <a id="criimlaunch" href="javascript:launchMacro();">Launch iMacros</a>

   </body>
</html>

Related forum post: How to run a macro from the command line using Chrome

Scripting Chrome and Firefox

Chrome and Firefox can be scripted with the iMacros scripting interface (API) included with some of the iMacros paid editions. The API allows you to control Chrome and Firefox from external scripts and programs (C++, C#, Python, Perl, Javascript, PowerShell, etc...). For details, see the chapter with the iimOpen command.

Notes:

  • In order to control iMacros for Chrome or Firefox via the iMacros scripting interface, you must install File Access for iMacros Extensions.
  • Please also read ScriptingInterface.readme.txt located in %localappdata%\Programs\iMacros after installing File Access!

Using Chrome and Firefox with the iMacros RunAs Agent (iimRunner)

iimRunner only works with a non-default Chrome UserDataDir or Firefox profile. See iMacros for Chrome and iMacros for Firefox for more details.

Where is the iimDisplay message?

iMacros web extensions show iimDisplay messages as a desktop notification pop-up window.

In iMacros for Chrome, if the sidebar is not available (e.g. if you start the browser from scripting interface API or run macros from bookmarks menu) errors and iimDisplay() messages are shown in a desktop notification pop-up window.

Getting Help

For issues activating the license, see the above section. If you run into any other issues, please don't hesitate to reach out on the iMacros forums. Take a good look through the forums before asking your question, we might already have a solution or work around available!

For direct email and phone support from an Ipswitch technical support representative, consider upgrading to a Professional or Enterprise Edition license.

See Also

Personal Edition, iMacros for Chrome, iMacros for Firefox, iMacros for Firefox Legacy, Features Comparison