Need new TABGROUP command

Currently there appears to be no way to query what tab group is loaded.

I have a saved set of tabs called 'Employees' that I can load with TABGROUPLOAD. Before I load it, I want to save the current tab set as 'LastUsed' so I can reload it later, so I do a TABGROUPSAVE, then TABGROUPLOAD.
This is controlled by a toggle on a toolbar button. I use a global variable to remember whether I have the Employees or LastUsed group loaded, so the toggle and switch between them.

The problem comes when I reboot my PC. The global variable is lost so I don't know which group is loaded. This can lead to TABGROUPSAVE saving the Employee group overwriting the LastUsed and therefore I lose all the tabs I had open from before loading Employees. If there was a builtin variable naming the currently loaded tab group, I could use that.

Here is the script I use:
@toggle:if $glob:EmplGrp
@ifset:$glob:EmplGrp
@set glob:EmplGrp
Go TABGROUPLOAD "LastUsed" TABCLOSEALL=yes
@ifset:else
@set glob:EmplGrp=on
Go TABGROUPSAVE "!both,LastUsed"
Go TABGROUPLOAD "Employee" TABCLOSEALL=yes

I have Dopus set to autosave then reload whatever tabs were open when Dopus/the PC is restarted. This is how I want it 99% of the time as I open and close all sorts of tabs.

From the help for @set

You can also mark variables to be saved on disk - their values will be remembered from one Opus session to the next. To accomplish this, simply add an exclamation mark (!) to the scope marker. For example, glob!: refers to a variable with global scope that will be saved on disk.

Regards, AB

Thanks AB, that works perfectly.
I need to study my scripting syntax more.
Case closed.