Support Portal

for ProcessRobot and WinAutomation

Start a new topic
Answered

set list itemnumber as a variable

I'm trying to pull a list item:

%VariableName[ItemNumber]%

example: %MyList[9]%

How do you change the item number to a variable

when I replace the "9" with a variable such as "%count%"  I get a syntax error.


Thank you for any help or suggestions.


Best Answer

Hi Don,

Please keep in mind that everything contained between two percentage marks (%) will be evaluated, and replaced with the final value.


In the case you mentioned, %MyList[%count%]% will be interpreted by WinAutomation like below (variables in bold):


%MyList[%count%]%

which is why you are getting a syntax error.

Since everything between the % signs will be evaluated first, all you need to do is use the index variable by name, without adding extra percentage signs:


%MyList[count]%

For a more detailed explanation on the use of percentage signs, please refer to the following article: https://support.softomotive.com/solution/articles/35000088650-usage-of-the-character


ADMIN
Answer

Hi Don,

Please keep in mind that everything contained between two percentage marks (%) will be evaluated, and replaced with the final value.


In the case you mentioned, %MyList[%count%]% will be interpreted by WinAutomation like below (variables in bold):


%MyList[%count%]%

which is why you are getting a syntax error.

Since everything between the % signs will be evaluated first, all you need to do is use the index variable by name, without adding extra percentage signs:


%MyList[count]%

For a more detailed explanation on the use of percentage signs, please refer to the following article: https://support.softomotive.com/solution/articles/35000088650-usage-of-the-character

Exactly what I needed. So simple!  Thank you

Login or Signup to post a comment