Save macro execution error in variable

Guys thank you so much for your help.

I have a parent macro that manages all other macros.

I am using! Errorignore to continue execution, ignore errors and do not stop execution because errors do not happen all the time.

I would like to collect these errors and save them in a database for future analysis.

My question is how to save the error in a variable.


Interesting. So you want to log the error message of the ignored error?

What if there are, for example, 3 ignored errors? Log them all?

I want the macro to run until the end even if it gives an error, that’s why I’m using the errorignore.

Yes, even if 3 errors occur I need to register them.


Can you use the log file?

From whatsnew page: Hard-drive mode: Log files (as shown in the log tab) are written to hard-drive. It is one file per UI.Vision start. The format is “log-day-time.txt”. You can also set the path via the -savelog command line switch.

But I can’t throw the error output in a variable?

This macro may be running on a user’s computer that I can’t access

I’m reading the kantu documentation and I see how good the tool is for the community. You are to be congratulated.

Reading the documentation and topics on the forum.

I wanted to record the errors or log outputs in a CSV file for future analysis.

Thank you for your help

Swith to hard drive mode and you have saved all log file in your hard drive.

Inside folder log you can find any command and any error saved.

Would you have an example of how to do it?


You must install this

After you can swith to hard drive mode and save logs, datasources, images, macros in hard drive

Yes, I already installed it because I was testing OCR.

I saw that when I switch to hard-disk it writes the log, I need to get the macro to read this file and send it to me by email.
Or take the log output and save it as CSV

The macro I send by email is ready.

I’m looking for how to do it, but I’m very doubtful about how to do it.

I do not know command to save in csv error message, i do not see any command to do this but i read a similar post and an user provide a possibile solution

Read here

Can you have a script like Powershell on this computer? If so, you can use it to load the log files and send them to you. Start the script via XRunAndWait from your macro.

But I can’t throw the error output in a variable?

I agree that would be nice to have. With the !statusOK internal variable you have the information if there was an error (it is true if no error happened, or false if there was an error. This works even with !errorIgnore. But you will not know what error it was.

Hi @thiagunix …do you have the Enterprise Edition? If so, please contact us and we can probably make a custom enhancement at no extra cost. Something like !LastErrorMessageText and !LastErrorMessageNumber that has the information of the last error that happened. It would get filled whenever !statusOK = false.

Or maybe we can simply add an internal variable called !Log that contains whatever is in the “Log Tab” of UI.Vision.

Email us at team AT to discuss this further. Just mention this forum post.

Without such a tweak, I think the suggestions made by others are good workarounds:

  • Use !statusOK
  • Log file(s) are created in hard drive mode. Use a script to collect them. Start the script by XRunAndWait.

The reason I fell in love with kantu is that I can run other programs.
More unfortunately I will not be able to run powershell or any other program.

As I understand it and test the commands statusOK and LastCommandOK return status of the last execution. Unfortunately for me it is not enough :frowning:

Hello @admin
I’m not an Enterprise Edition.

It would be great even if there were! LastErrorMessageText and! LastErrorMenssageNumber because sometimes you want to make a decision according to the error generated. Type one (switch case) or Try Catch.

When you exist running the macro on your local computer, you can monitor error or collect them. however, when you are a user running the macro via the runweb or something similar, you depend on the user to provide you with the errors if it exists and this becomes very bad because there are users who have no knowledge of Technology.

I’ll send an email to the AT team.
Thank you for your help