Run Shortcut with Selection for Widget Setup

Hello Simon,
Is it possible to add Run Shortcut with a selection when you setup the widget
Now I do that with the Callback-url

let Str_Shortcut=""
if (ScreenInfo=="GROCERY"){
	Str_Shortcut="SelectStore"
}

//--------------------------------------
//Setup for Launching ShortCuts in Script

const XCBURL =  "shortcuts://x-callback-url/run-shortcut"
let cb = new CallbackURL(XCBURL);
let cb1 = new CallbackURL(XCBURL);

function OpenShortCut(){
cb.addParameter("name", Str_Shortcut);
cb.open();
}

function OpenShortCut4Info(){
	cb1.addParameter("name", "Get_Volume");
	cb1.open();
}

You could assign the shortcuts:// url to the ListWidget.url property and it will run the shortcut when you tap the widget.

let widget = new ListWidget()
widget.url = 'shortcuts://run-shortcut?name=MyShortcut'

// more code

1 Like