Tips for using iMacros for Chrome freeware

Discussions and Tech Support specific to the iMacros for Chrome extension.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Marcia, Tech Support

Tips for using iMacros for Chrome freeware

Post by Marcia, Tech Support » Fri Dec 22, 2017 11:17 am

With the release of iMacros for Chrome 10, some of iMacros functionality is now only available in the licensed version. These are features we believe are most likely to be used in a business environment and should not affect hobby users of iMacros for Chrome.

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. To input data from CSV files, use an html file with a table where your data is displayed on a Chrome 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.

4. Besides the 3 user variables (!VAR1, !VAR2, and !VAR3), the !EXTRACT macro variable can also be used to "park" values. Or one can, as above, make use of an auxiliary html file loaded in a Chrome tab. A dummy form like in http://demo.imacros.net/Automate/AutoDataEntry might be all you need.


Sample HTML page to load a local CSV file and display it as a table in the browser:

Code: Select all

<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>
netkid
Posts: 2
Joined: Mon Apr 12, 2021 8:13 am

Re: Tips for using iMacros for Chrome freeware

Post by netkid » Mon Apr 12, 2021 11:51 am

Hi Marcia,

iMacros - it makes a lot of fun to work with.
With the help of an separate .htm-file I can't get any value . . .

Code: Select all

Table with loaded CSV file:
valueA1	valueA2	valueA3
valueB1	valueB2	valueB3
This code doesn't work:

Code: Select all

TAB T=2
URL GOTO=C:\Users\[USER]\Desktop\Test\iMacros_test.html
TAG POS=3 TYPE=TD ATTR=TXT:* EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
SET !EXTRACT NULL
How do you get the first value in line 1 into !VAR1?
Please can you help me?

Best,
netkid

VERSION BUILD=1010; File Access Not Installed
Microsoft Windows [Version 10.0.18363.1440]
netkid
Posts: 2
Joined: Mon Apr 12, 2021 8:13 am

Re: Tips for using iMacros for Chrome freeware

Post by netkid » Mon Apr 19, 2021 9:41 am

Dear community,

the iMacros demo-ExtractAndFill works on my PC:

Code: Select all

VERSION BUILD=10.4.28.1074
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=https://demo.imacros.net/Automate/ExtractDemo

TAG POS=39 TYPE=TD ATTR=TXT:* EXTRACT=TXT
SET !VAR1 {{!EXTRACT}} 
SET !EXTRACT NULL

TAG POS=40 TYPE=TD ATTR=TXT:* EXTRACT=TXT
SET !VAR2 {{!EXTRACT}}
SET !EXTRACT NULL

TAG POS=41 TYPE=TD ATTR=TXT:* EXTRACT=TXT
SET !VAR3 {{!EXTRACT}}
SET !EXTRACT NULL

'Now fill them in a form. This is only one example. You could use it also as part of link  
URL GOTO=https://demo.imacros.net/Automate/TestForm1   
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:name CONTENT=***Extract<SP>and<SP>Fill<SP>Demo*** 

'The variables are part of the CONTENT tag. You could use them as part of link
TAG POS=1 TYPE=TEXTAREA FORM=ID:demo ATTR=NAME:Remarks CONTENT=Extraction<SP>results:<BR><BR>One<SP>dollar<SP>costs<SP>{{!VAR1}}<SP>EURO,<SP>{{!VAR2}}<SP>Pounds<SP>or<SP>{{!VAR3}}<SP>Yen.
Now I've changed it - and created a new html-site:

Code: Select all

VERSION BUILD=1010 RECORDER=CR

TAB T=1
URL GOTO=file:///C:/Users/[USER]/Desktop/Test/table.html
TAB CLOSEALLOTHERS

TAG POS=3 TYPE=TD ATTR=TXT:* EXTRACT=TXT
SET !VAR1 {{!EXTRACT}} 
SET !EXTRACT NULL

TAG POS=1 TYPE=TEXTAREA FORM=ID:demo ATTR=NAME:Remarks CONTENT={{!VAR1}}
The code always stops at line "TAG POS=2 TYPE=TD ATTR=TXT:* EXTRACT=TXT".
I don't know what's wrong.
Please can you help me?

My own created page table.html:

Code: Select all

<style>
table.GeneratedTable {
  width: 50%;
  background-color: #ffffff;
  border-collapse: collapse;
  border-width: 1px;
  border-color: #000000;
  border-style: solid;
  color: #000000;
}

table.GeneratedTable td, table.GeneratedTable th {
  border-width: 1px;
  border-color: #000000;
  border-style: solid;
  padding: 3px;
}

table.GeneratedTable thead {
  background-color: #ffffff;
}
</style>

<table>
  <thead>
    <tr>
      <th>Customer</th>
      <th>Number</th>
      <th>Name</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
      	Value_A1
      	</td>
      <td>
      	Value_A2
      	</td>
      <td>
      	Value_A3
      	</td>
    </tr>
    <tr>
      <td>
      	Value_B1
      	</td>
      <td>
      	Value_B2
      	</td>
      <td>
      	Value_B3
      	</td>
    </tr>
  </tbody>
</table>
Any help woubld be appreciated.
Netkid
_____
IMacros VERSION BUILD=1010 RECORDER=CR
Microsoft Windows [Version 10.0.18363.1440]
Post Reply