Macro increment Numbers

i want to continue this process till it get 10 error continuously after 10 error macro should stop and then i should start the next macro for next ID
Or can anyone help me to download all the files in the database

{
“Name”: “KSP”,
“CreationDate”: “2022-3-30”,
“Commands”: [
{
“Command”: “open”,
“Target”: “https://ksp(DOT)karnataka(DOT)gov(DOT)in/firsearch/kn”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “id=district_id”,
“Value”: “65,16”,
“Description”: “”
},
{
“Command”: “select”,
“Target”: “id=district_id”,
“Value”: “label=Bagalkot”,
“Targets”: [
“id=district_id”,
“name=district_id”,
“xpath=//[@id="district_id"]",
“xpath=//select[@id=‘district_id’]”,
“xpath=//select”,
“css=#district_id”
],
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “id=district_id”,
“Value”: “0,-1”,
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “id=ps_id”,
“Value”: “56,23”,
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “id=fir_num”,
“Value”: “70,23”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=fir_num”,
“Value”: “0001”,
“Targets”: [
“id=fir_num”,
“name=fir_num”,
"xpath=//
[@id="fir_num"]”,
“xpath=//input[@id=‘fir_num’]”,
“xpath=//div[3]/input”,
“css=#fir_num”
],
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “xpath=/html/body/section/div[2]/div[3]/form/div[5]/input”,
“Value”: “-320,-717”,
“Description”: “”
},
{
“Command”: “selectWindow”,
“Target”: “tab=0”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=fir_num”,
“Value”: “0002”,
“Targets”: [
“id=fir_num”,
“name=fir_num”,
“xpath=//[@id="fir_num"]",
“xpath=//input[@id=‘fir_num’]”,
“xpath=//div[3]/input”,
“css=#fir_num”
],
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “xpath=/html/body/section/div[2]/div[3]/form/div[5]/input”,
“Value”: “-320,-717”,
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “id=fir_num”,
“Value”: “90,11”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=fir_num”,
“Value”: “0003”,
“Targets”: [
“id=fir_num”,
“name=fir_num”,
"xpath=//
[@id="fir_num"]”,
“xpath=//input[@id=‘fir_num’]”,
“xpath=//div[3]/input”,
“css=#fir_num”
],
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “xpath=/html/body/section/div[2]/div[3]/form/div[5]/input”,
“Value”: “-320,-717”,
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “id=fir_num”,
“Value”: “90,11”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=fir_num”,
“Value”: “0004”,
“Targets”: [
“id=fir_num”,
“name=fir_num”,
“xpath=//[@id="fir_num"]",
“xpath=//input[@id=‘fir_num’]”,
“xpath=//div[3]/input”,
“css=#fir_num”
],
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “xpath=/html/body/section/div[2]/div[3]/form/div[5]/input”,
“Value”: “-320,-717”,
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “id=fir_num”,
“Value”: “80,8”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=fir_num”,
“Value”: “0005”,
“Targets”: [
“id=fir_num”,
“name=fir_num”,
"xpath=//
[@id="fir_num"]”,
“xpath=//input[@id=‘fir_num’]”,
“xpath=//div[3]/input”,
“css=#fir_num”
],
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “xpath=/html/body/section/div[2]/div[3]/form/div[5]/input”,
“Value”: “-320,-717”,
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “id=fir_num”,
“Value”: “80,8”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=fir_num”,
“Value”: “0006”,
“Targets”: [
“id=fir_num”,
“name=fir_num”,
“xpath=//[@id="fir_num"]",
“xpath=//input[@id=‘fir_num’]”,
“xpath=//div[3]/input”,
“css=#fir_num”
],
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “xpath=/html/body/section/div[2]/div[3]/form/div[5]/input”,
“Value”: “-320,-717”,
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “id=fir_num”,
“Value”: “80,8”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=fir_num”,
“Value”: “0007”,
“Targets”: [
“id=fir_num”,
“name=fir_num”,
"xpath=//
[@id="fir_num"]”,
“xpath=//input[@id=‘fir_num’]”,
“xpath=//div[3]/input”,
“css=#fir_num”
],
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “xpath=/html/body/section/div[2]/div[3]/form/div[5]/input”,
“Value”: “-320,-717”,
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “id=fir_num”,
“Value”: “80,8”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=fir_num”,
“Value”: “0008”,
“Targets”: [
“id=fir_num”,
“name=fir_num”,
“xpath=//[@id="fir_num"]",
“xpath=//input[@id=‘fir_num’]”,
“xpath=//div[3]/input”,
“css=#fir_num”
],
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “xpath=/html/body/section/div[2]/div[3]/form/div[5]/input”,
“Value”: “-320,-717”,
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “id=fir_num”,
“Value”: “91,6”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=fir_num”,
“Value”: “0009”,
“Targets”: [
“id=fir_num”,
“name=fir_num”,
"xpath=//
[@id="fir_num"]”,
“xpath=//input[@id=‘fir_num’]”,
“xpath=//div[3]/input”,
“css=#fir_num”
],
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “xpath=/html/body/section/div[2]/div[3]/form/div[5]/input”,
“Value”: “-320,-717”,
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “id=fir_num”,
“Value”: “91,6”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=fir_num”,
“Value”: “0010”,
“Targets”: [
“id=fir_num”,
“name=fir_num”,
“xpath=//*[@id="fir_num"]”,
“xpath=//input[@id=‘fir_num’]”,
“xpath=//div[3]/input”,
“css=#fir_num”
],
“Description”: “”
},
{
“Command”: “clickAt”,
“Target”: “xpath=/html/body/section/div[2]/div[3]/form/div[5]/input”,
“Value”: “-320,-717”,
“Description”: “”
}
]
}