How to trigger an event at end of macro with hundreds of loops?


#1

Hello,

I have created a macro that goes through a csv file and completes tasks.

I’m wanting to save an error log to my computer after the entire macro is completed, however, when I add the following to the end:

{
“Command”: “localStorageExport”,
“Target”: “log”,
“Value”: “”
}

it asks me to save after EACH loop, which would be hundreds potentially. Just wanting one Final summary basically. Is this possible?

Here is my basic program:

{
“Name”: “DemoCsvReadWithLoop_duplicate/mod”,
“CreationDate”: “2019-3-14”,
“Commands”: [
{
“Command”: “store”,
“Target”: “fast”,
“Value”: “!replayspeed”
},
{
“Command”: “csvRead”,
“Target”: “loopingtues1.csv”,
“Value”: “”
},
{
“Command”: “open”,
“Target”: “{!COL1}", "Value": "" }, { "Command": "comment", "Target": "", "Value": "has opened the administrator backend" }, { "Command": "type", "Target": "name=rsf_backend_password", "Value": "{!COL2}”
},
{
“Command”: “clickAndWait”,
“Target”: “/html/body/div[1]/form/button”,
“Value”: “”
},
{
“Command”: “comment”,
“Target”: “”,
“Value”: “submit button from firewall, next step goes into main login”
},
{
“Command”: “type”,
“Target”: “id=mod-login-username”,
“Value”: “{!COL3}" }, { "Command": "type", "Target": "id=mod-login-password", "Value": "{!COL4}”
},
{
“Command”: “clickAndWait”,
“Target”: “//[@id=“form-login”]/fieldset/div[3]/div/div/button",
“Value”: “”
},
{
“Command”: “comment”,
“Target”: “”,
“Value”: “submit button from main login”
},
{
“Command”: “click”,
“Target”: “link=Extensions”,
“Value”: “”
},
{
“Command”: “clickAndWait”,
“Target”: “link=Plugins”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “id=filter_search”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=filter_search”,
“Value”: “System - Update Notification”
},
{
“Command”: “comment”,
“Target”: “”,
“Value”: “this is searching for the specific system update plugin”
},
{
“Command”: “clickAndWait”,
“Target”: "//
[@id=“j-main-container”]/div[1]/div[1]/div[1]/div[1]/button”,
“Value”: “”
},
{
“Command”: “comment”,
“Target”: “”,
“Value”: “submit button to search”
},
{
“Command”: “click”,
“Target”: “id=cb0”,
“Value”: “”
},
{
“Command”: “comment”,
“Target”: “”,
“Value”: “this is the checkbox for the plugin”
},
{
“Command”: “click”,
“Target”: “//*[@id=“toolbar-unpublish”]/button”,
“Value”: “”
},
{
“Command”: “comment”,
“Target”: “”,
“Value”: “this is the unpublish button”
},
{
“Command”: “click”,
“Target”: “link=User Menu”,
“Value”: “”
},
{
“Command”: “clickAndWait”,
“Target”: “link=Logout”,
“Value”: “”
},
{
“Command”: “comment”,
“Target”: “”,
“Value”: “logs out of admin backend”
}
]
}


#2

In thsi case do not use the loop method, but use While to read the CSV file line by line. See this demo macro: DemoCsvReadWithWhile (it ships with Kantu)

Then, at the end of the while loop, you can save the log file. Or use the command line.


#3

Ok will try tying it in that way.

Also, the current way of timing out is nice when encountering an error. Is there anything I need to know going the While route? I basically want this program to timeout after hitting an error, log it, then just continue to the next loop. I see some errorignore stuff in the While macro, is this necessary?

Thank you,

Steph


#4

Yes - otherwise the errors will stop the macro. Or use the command line: https://a9t9.com/kantu/docs#247