Speed faster than 'fast'?

I have seen other posts talk about using nodisplay, of which I have done, but is there an option to make it even quicker?

I have a really simple script - last year I used iMacros and it flies through the csv files (approx 1200 rows) in a few seconds. This takes a few seconds on each row.

Any pointers welcome

Thank you!

{
  "Name": "register works but slow",
  "CreationDate": "2022-5-14",
  "Commands": [
    {
      "Command": "store",
      "Target": "nodisplay",
      "Value": "!REPLAYSPEED",
      "Description": ""
    },
    {
      "Command": "csvRead",
      "Target": "cv01.csv",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "comment",
      "Target": "click // id=enterRollNumberInput",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "id=enterRollNumberInput",
      "Value": "${!COL1}",
      "Targets": [
        "id=enterRollNumberInput",
        "xpath=//*[@id=\"enterRollNumberInput\"]",
        "xpath=//input[@id='enterRollNumberInput']",
        "xpath=//div[2]/div/input",
        "css=#enterRollNumberInput"
      ],
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "id=enterRollNumberButton",
      "Value": "",
      "Targets": [
        "id=enterRollNumberButton",
        "xpath=//*[@id=\"enterRollNumberButton\"]",
        "xpath=//button[@id='enterRollNumberButton']",
        "xpath=//div[2]/button",
        "css=#enterRollNumberButton"
      ],
      "Description": ""
    }
  ]
}

Can you see what line takes the most time?

One speed up idea:

Replace csvRead with csvReadArray and then loop over the array. This way you read the CSV file only once. With csvRead you read the whole CSV file once for each loop.

This macro takes ~12 seconds on my machine for a ~1000 lines CSV file.

And if I select “No Log” (<= dropdown on the top right of the “Logs” tab) it takes ~ 9s.

Please let me know if this idea helped :wink:

{
  "Name": "Readcsvarry1000",
  "CreationDate": "2022-5-15",
  "Commands": [
    {
      "Command": "store",
      "Target": "500",
      "Value": "!timeout_macro",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "fast",
      "Value": "!replayspeed",
      "Description": "220 seconds runtime with this setting"
    },
    {
      "Command": "store",
      "Target": "nodisplay",
      "Value": "!replayspeed",
      "Description": "12 seconds runtime with this setting. Or 9s with No Log."
    },
    {
      "Command": "comment",
      "Target": "The file ReadCSVTestData.csv is pre-installed with UI.Vision RPA.",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "csvReadArray",
      "Target": "ReadCSVTestData.csv",
      "Value": "a1",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Number of rows = ${!CsvReadMaxRow}",
      "Value": "green",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return ${a1[0]}.length;",
      "Value": "col",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Number of columns = ${col}",
      "Value": "pink",
      "Description": ""
    },
    {
      "Command": "comment",
      "Target": "loop over all CSV values",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "forEach",
      "Target": "a1",
      "Value": "row",
      "Description": "For each loop this command moves one line of \"a1! array (2-dim array) into \"row\" (1-dim array)"
    },
    {
      "Command": "echo",
      "Target": "col1=${row[0]}, col2=${row[1]}, col3=${row[2]}",
      "Value": "brown",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "",
      "Target": "",
      "Value": "",
      "Description": ""
    }
  ]
}
3 Likes

Thank you!

I’ve updated my script to use the array (only have one col) and it’s slightly quicker but not as fast as what you said, https://www.screencast.com/t/TiimOp7KAwzY.

Using hard drive storage and no log.

Have I missed something obvious?

{
  "Name": "From Forum",
  "CreationDate": "2022-5-16",
  "Commands": [
    {
      "Command": "store",
      "Target": "500",
      "Value": "!timeout_macro",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "fast",
      "Value": "!replayspeed",
      "Description": "220 seconds runtime with this setting"
    },
    {
      "Command": "store",
      "Target": "nodisplay",
      "Value": "!replayspeed",
      "Description": "12 seconds runtime with this setting. Or 9s with No Log."
    },
    {
      "Command": "csvReadArray",
      "Target": "CV01.csv",
      "Value": "a1",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Number of rows = ${!CsvReadMaxRow}",
      "Value": "green",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return ${a1[0]}.length;",
      "Value": "col",
      "Description": ""
    },
    {
      "Command": "comment",
      "Target": "loop over all CSV values",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "forEach",
      "Target": "a1",
      "Value": "row",
      "Description": "For each loop this command moves one line of \"a1! array (2-dim array) into \"row\" (1-dim array)"
    },
    {
      "Command": "echo",
      "Target": "col1=${row[0]}",
      "Value": "brown",
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "id=enterRollNumberInput",
      "Value": "${row[0]}",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "id=enterRollNumberButton",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    }
  ]
}

Ah, then it seems the main delay comes from the execution time of the CLICK and TYPE commands. My test macro did not have these.

But their runtime depends on the website, so I can not test further. It seems here iMacros is simply faster.

You could try using XClick and XType instead of Click and Type, maybe they are faster.

If you test it, make sure to set the focus on the input box.

Also, you can maybe save the CLICK on the button completely by sending the ENTER return key at the same time as the data. So try XTYPE | ${row[0]}${KEY_ENTER}

Does this improve anything?

1 Like

Thank you for the pointers! I think you’re right about changing the click with a return, though when I do that it converts it as text; 2022-05-20_22-14-16

When I try and convert it to XClick and XType it doesn’t fill,

 {
      "Command": "XClick",
      "Target": "id=enterRollNumberInput",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "XType",
      "Target": "${row[0]}${KEY_ENTER}",
      "Value": "",
      "Description": ""
    },

It then says there are more than 25 commands and need a license - more than happy to pay if that gets me the speed boost I’m after!

Just as a test, does this work?

XTYPE | 6${KEY_ENTER}

Same result, it’s like the key_enter is not being triggered