"save currently active window" for multiple windows

is there any way to have this action remember multiple windows, perhaps by storing references in a variable?

it would require scripting.

Here is an example:

Save the currently focused window id:

async function saveCurrentWindowID() {
		// get the active window number
        let activeWindow = await get_number_variable("BTTActiveWindowNumber");
		
		// save the active window number to some variable
		await set_number_variable({variableName: "Window1", to: activeWindow});
		return activeWindow;
}

Bring the saved window to front:

//if you rename this, make sure to also rename it in the "function to call" field below.
async function restoreWindow1() {
    let window1 = await get_number_variable("Window1");		
    BTTActions.activateWindowWithNumberRaiseAppID(window1, true,-1)
}
1 Like

excellent, thank you :slight_smile: