Indirect function

On my IPhone I have split up my Icons and shortcuts per screen.
I made a script where the parameter is the name of the screen.
The parameter is saved in a variable “ScreenInfo”.
Now I want to use value of the “ScreenInfo” as an indirect value to get another info that I want to use in my Header between the stars


You can acess your widget parameter using args.widgetParameter

Yep, this I know, and I save it in a variable.
Then I use it in a second variable which I use to launch a Shortcut, but I would also use it for other subjects, like background of the widget or header.
Now I have to use the “If” clause… with a kind of case selection (selection from my 7 screens)

//Variables used by Scriptable.
//must be at the very top of the file. Do not edit.

// Widget Params, default values for debugging

let ScreenInfo = args.widgetParameter

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();
}


// setup your predefined settings
const screenSettings = {
  GROCERY: {
    shortcut: 'SelectStore',
    bgcolor: Color.blue()
  },
  HOME: {
    shortcut: 'AnotherShortcut',
    bgcolor : Color.green()
  }
}

// get name of the screen you want to use
let ScreenInfo = args.widgetParameter

// pick the settings based on the parameter
var settings = screenSettings[ScreenInfo]

// use the setting

let widget = new ListWidget()
widget.backgroundColor = settings.bgcolor

// ...


function OpenShortCut(){
  const XCBURL =  "shortcuts://x-callback-url/
  let cb = new CallbackURL(XCBURL);
  cb.addParameter("name", settings.shortcut);
  cb.open();
}




Alright thanx, super, this is what I wanted to do!!!
Results into 1 Widgetscript for 7 different Screen Subjects