I am taught by trial, error and this forum so I feel you, but once you get the hang of them, they are awesome!
Sorry, that snipit is running inside a times loop (I only copied a short portion of code just to show assigning GLOBAL variables and did not think of that additional piece). I have it reading from a CSV file with many records so the {!times} is in relation to the number of times through the loop (i.e. which line of the array). I refer to the variables a lot and found it much easier to name the variables something that was more meaningful to a human and meant that I could assign the values in the “Full Process” macro so different “full processes” that used the same “submacros” could assign the correct values even if the CSV/array had things in a different order.
I had a similar issue with saving things in one of the programs I use where there were several possible outcomes and each could need to handle something differently based on the Macro that I was saving from. There is probably a more elegant/efficient way to do but I handled it by creating a save “sub-macro” that used OCR Search/Visual Verify of the different conditions and if/else/end statements. If the message that it was checking for was displayed, it would send the value I assigned and then the macro that called the save would act based on the result in the GLOBAL variable (since it could differ based on what was being saved) but it sounds like you would want to replace storing GLOBALBannerSaveResults and gotolabel (which just was the last line of the Macro so it skipped any remaining checks that would have been redundant at that point and avoided nested if/else statements which can sometimes get hard to read when trying to fix an error) with run macro_routineN or creating a login macro and just listing the four options in if/else statements. Again, probably a better way but that was just what I could figure out.
{
"Command": "OCRSearch",
"Target": "Saved success",
"Value": "count",
"Description": ""
},
{
"Command": "if",
"Target": "${count}>0",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "Saved Successfully",
"Value": "GLOBALBannerSaveResults",
"Description": ""
},
{
"Command": "gotoLabel",
"Target": "SaveEnd",
"Value": "",
"Description": ""
},
{
"Command": "else",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "OCRSearch",
"Target": "No changes to save",
"Value": "count",
"Description": ""
},
{
"Command": "if",
"Target": "${count}>0",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "No changes",
"Value": "GLOBALBannerSaveResults",
"Description": ""
},
{
"Command": "gotoLabel",
"Target": "SaveEnd",
"Value": "",
"Description": ""
},
{
"Command": "else",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "label",
"Target": "SaveEnd",
"Value": "",
"Description": "Used as an alternate to nested if/else/end statements for simplicity to add additional conditions when needed in the future"
},