Event in which I can run a script after UIVISION ends

Is there any way or event in which I can run a script that sends an email right after UIVISION writes the following text to the logs?

[report]Test Suite name: Tests
Start Time: Mon Apr 29 2024 13:29:05 GMT+0200 (Central European Summer Time)
Overall status: Error, Runtime: 168.98s
Macro run: 3
Success: 2
Failure: 1

I have the problem right at that moment, because if I launch a macro that sends an email, that report has not yet been written in the logs, and of course, I go through those logs to know the results of the tests, based on those lines of report.

Thank you!

Hello Catlikesbest@avarela,

To run a script that sends an email immediately after UI.Vision RPA writes the test suite results to the logs, you can utilize the command line API provided by UI.Vision. This allows you to execute a macro or a series of commands after the completion of your test suite.

Here’s a general approach you can take.

Create a batch file or script that runs your UI.Vision test suite via the command line.
Include a command in the script to check the log file for the specific text indicating the test suite has finished.
Once the condition is met, have the script execute the email-sending macro or use another tool like PowerShell, Python, or a shell script to send the email.

:: Run the UI.Vision test suite
start "" "C:\Program Files (x86)\UI.Vision RPA\uivision.exe" "path\to\test_suite.json"

:: Wait for the test suite to complete
timeout /t 5
findstr /m "Overall status: Error" "path\to\log_file.txt"
if %errorlevel%==1 goto wait

:: Send the email
start "" "C:\path\to\email_sending_macro.json"

The start command is used to run the test suite and the email macro.
The timeout command pauses the script for a specified number of seconds.
The findstr command searches for the specific text in the log file.
The if %errorlevel%==1 checks if the text was not found and if so, it loops back to wait again.
Remember to replace “path\to\test_suite.json”, “path\to\log_file.txt”, and “C:\path\to\email_sending_macro.json” with the actual paths to your test suite, log file, and email macro respectively.

This is just a basic example, and you may need to adjust the script to fit your specific requirements and environment. Additionally, if you’re using a different operating system, the commands will vary.

Best Regards,

Hello, thank you for your response, the script is very well thought out, but it would not work for me, since UIVISON generates the logs dynamically with the day and time as the file name, even more than one per day, if the macro closes the browser, so your idea doesn’t work for me, at least, the way you put it, something like this:

Why not just have the script move the log to a different folder after acting on it?