Random variable

Hello

I am using KANTU for a repetitive task, to refresh a page and to click on a button at a set time.
The command lines for the pause segment look like this:

{
“Command”: “pause”,
“Target”: “30000”,
“Value”: “”
},

I would like the target to be randomized between two values, preferably not 0 to X, but X to Y.

I found this topic How to pause macros - UI.Vision RPA - UI.Vision RPA Software Forum | Discuss RPA Automation, Selenium IDE and OCR API Text Recognition but I cannot understand how to transfer commands to my “program”.

Can someone help me with this issue?

Best regards

just copy this code in your macro. It makes random delays between 1s (1000) and 61s (1000+60000):

{
  "Command": "storeEval",
  "Target": "1000 +  Math.floor(Math.random()*60000) ",
  "Value": "waittime"
},
{
  "Command": "pause",
  "Target": "${waittime}",
  "Value": ""
},

I have tried your code, but I receive the error:

Error in runEval code: Refused to evaluate a string as JavaScript because ‘unsafe-eval’ is not an allowed source of script in the following Content Security Policy directive: “script-src ‘self’ ‘unsafe-inline’ http://js-agent.newrelic. http://bam.nr-data. *.walkme. d3b3ehuo35wzeh.cloudfront. d3sbxpiag177w8.cloudfront.”.

Those are webpages, but I erased the .com and .net because the forum does no allow me to post multiple links.

I searched through a9t9 forums and found this:

You just have to switch to tab (with selectWindow) where storeEval is allowed.

Being thick, I lack the knowledge to do this.
Can you help?

With 'unsafe-eval' is not an allowed source of script - #5 by nthnlws - UI.Vision RPA - UI.Vision RPA Software Forum | Discuss RPA Automation, Selenium IDE and OCR API Text Recognition you found the right post!

storeEval runs Javascript inside the website, and some websites block this. Solution: Open another website that does not block it, run storeEval, and then switch back.

  • selectWindow | TAB=OPEN | https://a9t9.com
  • storeEval |…
  • selectWindow | TAB=CLOSE

…and then continue with your normal macro.

Refused to evaluate a string as JavaScript because ‘unsafe-eval’ is not an allowed source of script in the following Content Security Policy directive:

Meanwhile the solution is easy. Use executeScript _Sandbox:

{
  "Command": "executeScript_Sandbox",
  "Target": "return 1000 +  Math.floor(Math.random()*60000); ",
  "Value": "waittime"
},
{
  "Command": "pause",
  "Target": "${waittime}",
  "Value": ""
},

After little tinkering, I managed to insert your sequence in my software and I am testing it now. It seems to be working very well.