How to run a shortcut every 30min

The 5 seconds is for testing aiming for 30 min anyways
If i leave this out.

const SHORTCUTNAME = "Random-Wallpaper-Home";
const BASEURL = "shortcuts://run-shortcut?name="; + encodeURI(SHORTCUTNAME));



Displays every 5 sec but for some reason if i put in the code above. Every thing goes blank.

"use strict" 
let wv = new WebView();
await wv.loadHTML("");
let js = `
const run = setInterval(runShortCut, 5000);
function runShortCut() {
const SHORTCUTNAME = "Random-Wallpaper-Home";
const BASEURL = "shortcuts://run-shortcut?name="; + encodeURI(SHORTCUTNAME));

 let result = await wv.evaluateJavaScript(js, true) ;

I don’t think you can run in the context of the browser. is a scriptable api method. That javascript you send to the browser has to match the browsers API. You can use in the actual browser

There’s a Timer class that you can use instead of setInterval.
The code below worked for me but I haven’t tested for longer periods.
I’m also not sure if you need to keep Scriptable open while this is running. Maybe add an Open App action to your shortcut to go back to Scriptable after the shortcut completes.

const SHORTCUTNAME = 'MyShortcut'

await repeat(5000, 5, () => {

function runShortcut(name) {
  const cb = new CallbackURL('shortcuts://run-shortcut')
  cb.addParameter('name', name)

function repeat(interval, max, func) {
  // interval in milliseconds
  // max is number of repetitions. set to -1 for infinite
  // function to run for each repetition
  return new Promise((resolve, reject) => {
    let repetitions = 0
    const t = new Timer()
    t.timeInterval = interval
    t.repeats = true
    t.schedule(() => {

      repetitions = repetitions + 1


      // stop the timer of max is reached
      // will never evalues to true if max = -1
      if (repetitions == max) {

    }) // schedule
  }) // Promise
} // function repeat