captureDesktopScreenshot works when debugging, but fails when macro is scheduled automatic execution

I’m new to UI.Vision and this is my first RPA macro. I have, as the topic says, the captureDesktopScreenshot step and it works perfectly when debugging (step or run macro from the UI), but fails when I have the macro scheduled and furthermore, I’m not finding the logs from the macro anywhere to check what was the issue.

This is the part that fails (last one)
{
“Command”: “storeEval”,
“Target”: “var d=new Date(); d.getDate()+’-’+((d.getMonth()+1))+’-’+d.getFullYear();”,
“Value”: “Date”
},
{
“Command”: “storeEval”,
“Target”: “(new Date().getHours()+” " + new Date().getMinutes() + " " + new Date().getSeconds()) ",
“Value”: “Time”
},
{
“Command”: “store”,
“Target”: “screen-{Date}-{Time}.png”,
“Value”: “Screen”
},
{
“Command”: “captureDesktopScreenshot”,
“Target”: “c:/temp/kuva_${Time}.png”,
“Value”: “”
},
{
“Command”: “pause”,
“Target”: “2000”,
“Value”: “”
},

Any ideas?

Thanks,
Jukka

forgot to mention, that I use latest Firefox browser.

How do you have it scheduled? The RPA software can only take a screenshot if the system is unlocked. See also https://ui.vision/howto/taskscheduler#locked

Log file: If you have the XModule extension installed, the log file is created in Home Folder / Logs e. g. C:\Users\ulrich\Desktop\uivision\logs

See also: How to store logs of each session in a single text file

1 Like

StoreEval is deprecated do not use it.

Use new executescript_Sandbox to calculate date and time

1 Like

StoreEval is deprecated do not use it.

Here seems missing $

“Target”: “screen-{Date}-{Time}.png”,

Use new executescript_Sandbox to calcilate date and time

1 Like

Many thanks Ulrich! I have Windows virtual machine to run RPA. I will try the screenshot when unlocked.

One thing that still puzzles me, where I need the logs, is that I find the Firefox browser hanged in processed after the script has executed. I don’t see it happening when manually launch, only when executed by task sceduler. Because of that, I need to have another task scheduled, which kills that firefox process just before the RPA script starts. Do you have experience what are the typical reasons causing the browser hang?

I use captureDesktopScreenshot in virtualbox machine and working like a charm.

Check possible errors in your macro code.