How do I pass many parameters from VB.Net to a macro?

We pass over 10 parameters to our iMacros programmatically using VB.Net, some of which are long text. They are used to fill a form. Do you have any plans to introduce similar functionality in your product? I read that you can pass 3 parameters thru the command line, or read more from a text file, but neither one of these are adequate. Saving sensitive parameters to a text file, as well as issues with having carriage returns in a text in a csv file make the second option unappealing. We are considering switching from iMacros to your product. Thank you.

You can pass infinite parameters via url and then extrapolate them as you like and save them in separate variables.

You don’t need to rely on the default variables since you can create the url as you prefer and then save the individual parts in variables of your choice

1 Like

Correct, ui.vision can send only cmd_var1, cmd_var2 and cmd_var3. These variable names are fixed.

But as @newuserkantu mentioned, there is a good workaround. You can combine all your 10+ values into one long string, and then, inside the macro, split the string into its part again:

In the macro below I show how it is done. Assume !cmd_var1 would contain this string:

aaaaaaXXX111\n\bbbbXXX1 2 3 4 5XXXChinese你好XXXLong text: The Send-MailMessage cmdlet uses the From parameter to specify the message’s sender. The To parameter specifies the message’s recipient. The Subject parameter uses the text string Test mail as the message because the optional Body parameter is not includedXXXthis works.

and then inside the macro split the string at XXX. So now the array (“a” in the macro below) contains the separate values.

You can now use e. g. forEach to loop over this array, or get your values with the [x] array notation:

  • echo | Value1 is ${a[0]}
  • echo | Value2 is ${a[1]}
  • …
  • echo | Value30 would be in ${a[29]}

Result:

split string

Macro:

{
  "Name": "split string",
  "CreationDate": "2023-2-7",
  "Commands": [
    {
      "Command": "store",
      "Target": "aaaaaaXXX111\\n\\bbbbXXX1 2 3 4 5XXXChinese你好XXXLong text: The Send-MailMessage cmdlet uses the From parameter to specify the message's sender. The To parameter specifies the message's recipient. The Subject parameter uses the text string Test mail as the message because the optional Body parameter is not includedXXXthis works.",
      "Value": "var1",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "s = ${var1}; myArray = s.split(\"XXX\"); return myArray;",
      "Value": "a",
      "Description": ""
    },
    {
      "Command": "forEach",
      "Target": "a",
      "Value": "value",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Value is: ${value}",
      "Value": "green",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "comment",
      "Target": "You can also access the array values this way:",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Value1 = ${a[0]}",
      "Value": "blue",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Value2 = ${a[1]}",
      "Value": "pink",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Value3 = ${a[2]}",
      "Value": "brown",
      "Description": ""
    }
  ]
}
3 Likes

Ok, thank you all for your response. I will have to study your posts since I am new to the product.

Congrats you’ve created some really excellent macro code

1 Like

It’s 2025 now and I started looking again at Ui Vision to replace iMacros having several setbacks. Now regarding this topic again I will need to find a solution to pass many parameters to Ui Vision from a VB.Net app, but they need to be confidential and not passed by a command line or URL, which can be saved in a history. These params contain sensitive data, so I need to pass them internally as I did in iMacros. Any suggestions? Thank you.

I have not tried that but maybe you can store the values within your VB.net into a session variable. The do only exist in memory as long as the browser is open. In Kantu you could try to get the session values back with a javascript and store them in Kantu to process.