Ignore last command

Hello, if I push Play Loop 1-3, how can I do to ignore the last command?

xpath=//*[@id=“ScheduleManageForm”]/input[5]

The goal is always ignore the last commando in the last loop. So, if I play loop 1-3, 1-10, etc I want always ignore the last command in the last loop. I’ve tried times, break, but I was not able to solve it. Thanks.

Here is the script:

{
“Name”: “Station ADD Schedule”,
“CreationDate”: “2024-9-13”,
“Commands”: [
{
“Command”: “type”,
“Target”: “name=schedule.0.duration”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “csvRead”,
“Target”: “stations.csv”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “xpath=//[@id="c117_c233_0_c117_c233_0_c243_${!COL1}c117_c233_0_c243${!COL1}_c272"]/input",
“Value”: “${!COL3}”,
“Targets”: [
"xpath=//
[@id="c117_c233_0_c117_c233_0_c243_0_c117_c233_0_c243_0_c272"]/input”,
“xpath=//input[@type=‘text’]”,
“xpath=//div/input”,
“css=#c117_c233_0_c117_c233_0_c243_0_c117_c233_0_c243_0_c272 > input”
],
“Description”: “”
},
{
“Command”: “type”,
“Target”: “name=schedule.${!COL1}.days”,
“Value”: “${!COL13}”,
“Targets”: [
“name=schedule.0.days”,
“xpath=//[@id="scheduletable"]/tbody/tr/td[5]/input",
“xpath=//input[@name=‘schedule.0.days’]”,
“xpath=//td[5]/input”,
“css=#scheduletable > tbody > tr > td:nth-child(5) > input”
],
“Description”: “”
},
{
“Command”: “type”,
“Target”: “name=schedule.${!COL1}.start”,
“Value”: “${!COL5}”,
“Targets”: [
“name=schedule.0.start”,
"xpath=//
[@id="scheduletable"]/tbody/tr/td[6]/input”,
“xpath=//input[@name=‘schedule.0.start’]”,
“xpath=//td[6]/input”,
“css=#scheduletable > tbody > tr > td:nth-child(6) > input”
],
“Description”: “”
},
{
“Command”: “type”,
“Target”: “name=schedule.${!COL1}.end”,
“Value”: “${!COL6}”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “new row”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “pause // 2000”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//*[@id="ScheduleManageForm"]/input[5]”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “pause // 5000”,
“Value”: “”,
“Description”: “”
}
]
}

I would not use the loop button. Instead use, for example, the TIMES command.

Then you can have:

  • store | 8 | maxloop - 8 if you want to run 8 loops. Just an example.
  • TIMES | maxloop
  • your code here
  • IF | ${!TIMES} != ${maxloop} - this means you run the last command all the time, except at the 8th (= last) loop
    - LAST COMMAND HERE
  • END (if)
  • END (times)

Hello, thanks for the tip… I’ve edited my code. Are you saying I should press “Play” instead of “Play Loop”? If that’s the case, it doesn’t work as expected because I need to use “Play Loop” since ${!COL1} and others contain variables with different row numbers. Any help is appreciated. My original script works fine, for example, if I run the loop from 1 to 8, it runs smoothly. However, the goal is to skip the last command on the final loop, which in this case is 8. Of course, the number 8 can change.

Last command:
xpath=//*[@id=“ScheduleManageForm”]/input[5]

Edited code with your suggestion:

{
“Name”: “test - ADD Schedule (STAGE)-1”,
“CreationDate”: “2024-9-15”,
“Commands”: [
{
“Command”: “type”,
“Target”: “name=schedule.0.duration”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “csvRead”,
“Target”: “stations.csv”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “xpath=//[@id="c117_c233_0_c117_c233_0_c243_${!COL1}c117_c233_0_c243${!COL1}_c272"]/input",
“Value”: “${!COL3}”,
“Targets”: [
"xpath=//
[@id="c117_c233_0_c117_c233_0_c243_0_c117_c233_0_c243_0_c272"]/input”,
“xpath=//input[@type=‘text’]”,
“xpath=//div/input”,
“css=#c117_c233_0_c117_c233_0_c243_0_c117_c233_0_c243_0_c272 > input”
],
“Description”: “”
},
{
“Command”: “type”,
“Target”: “name=schedule.${!COL1}.days”,
“Value”: “${!COL13}”,
“Targets”: [
“name=schedule.0.days”,
“xpath=//[@id="scheduletable"]/tbody/tr/td[5]/input",
“xpath=//input[@name=‘schedule.0.days’]”,
“xpath=//td[5]/input”,
“css=#scheduletable > tbody > tr > td:nth-child(5) > input”
],
“Description”: “”
},
{
“Command”: “type”,
“Target”: “name=schedule.${!COL1}.start”,
“Value”: “${!COL5}”,
“Targets”: [
“name=schedule.0.start”,
"xpath=//
[@id="scheduletable"]/tbody/tr/td[6]/input”,
“xpath=//input[@name=‘schedule.0.start’]”,
“xpath=//td[6]/input”,
“css=#scheduletable > tbody > tr > td:nth-child(6) > input”
],
“Description”: “”
},
{
“Command”: “type”,
“Target”: “name=schedule.${!COL1}.end”,
“Value”: “${!COL6}”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “max loop”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “3”,
“Value”: “maxloop”,
“Description”: “”
},
{
“Command”: “times”,
“Target”: “${maxloop}”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “if”,
“Target”: “${!TIMES} != ${maxloop}”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “new row”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “pause // 2000”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//*[@id="ScheduleManageForm"]/input[5]”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “pause // 5000”,
“Value”: “”,
“Description”: “”
}
]
}

Yes

Please see the DemoCsvReadWithWhile that ships with Ui.Vision. It shows how to read from CSV files without using the LOOP button.

Thank you very much!