r/Scriptable • u/95tyke • Dec 04 '22
Help How do I recreate this shortcut so that the JavaScript runs in Scriptable instead? The URL never changes
14
Upvotes
r/Scriptable • u/95tyke • Dec 04 '22
4
u/FifiTheBulldog script/widget helper Dec 05 '22
Your Scriptable script should follow this flow:
WebView.loadURL()method of the WebView instance to load the webpage. Make sure toawaitthis.evaluateJavaScript()method of the WebView instance to run the same JS that you have from your shortcut in the webpage environment. The first argument of this function will be the JS as a string, and the second should betrueif you wantcompletion()to be available.awaitthis as well.evaluateJavaScriptis the result. If you’re running this in Shortcuts, then you can return that value from the Run Inline Script action to use it elsewhere in your shortcut.