Linking MySQL database via JavaScript

Instead of saving the results to a CSV file, can I use MySQL instead and insert the records directly to my database?

You can connect to MySQL via a local script (Node.js, Python, VBS,…) that you call with XRun.

Or do it the other way: Have a local script e. g. Node.js run everything and start UIvision via the command line API.

@admin

We’re doing option 2 (via Node.js script via command line API) but the sample script on GitHub has a timeout.

Our macros doesn’t have a constant time when it will be finished – some will take 30 seconds, some will take a longer period so using a timeout on our case isnt advisable. Instead of timeout deciding if our run is completed, how would we know if the process initiated by the API starts UI Vision and when the process counts as finished? Is there an internal variable that we can use?

Good question. I suggest to do it as in the sample scripts: UIVision creates a log file when done. You can watch for this log file to appear. This will tell you when the process has finished.

See here: RPA/command-line/node.js/uitest.js at 208b8c417b5f1167e881712f4378e7ba7d59cfb4 · A9T9/RPA · GitHub

The timeout in the Node.js (and other) scripts is only to prevent endless waiting in case “something” happens to UIVision or the browser, e. g. for the rare case when the browser or UIvision freezes or crashes. So you can make this timeout very long, longer than your longest process will never need.

how would we know if the process initiated by the API starts

There is no feedback for the start of the browser. But if you want, you could make your macro write a CSV file to check. But I do not think that is needed.

… and when the process counts as finished?

Wait for the log file to appear. The first line of the log file has the status code (error or not, and the error message if any). That is why the script reads the first line of the log.