For years I have been using a recursive custom function to get a list of all the Selected Tab Panels on a layout.  This works quite well, but in my current project I wanted to get rid of all custom functions. I didn’t really want to use a looping script. I wanted a pure calculation that could do it.  This is what I came up with.

---------------------------------------------
Evaluate("List(¶"  &
Let(
[
left =  "Let(
		
;Case(GetLayoutObjectAttribute ( tab ; "isFrontTabPanel" ) ; tab;""));"; tabs = Substitute( LayoutObjectNames ( Get( FileName ); Get( LayoutName ) ); ["<¶";""]; [">¶";""]; [">";""] ) ]; left & Substitute( tabs; "¶"; right & "¶" & left ) & right ) &"¶)" )
---------------------------------------------

This seems to work pretty well.

Apologies, the download file has gone missing.