reference:scripting_reference:scripting_events:onactivatetab

The OnActivateTab event can be implemented by a script add-in to receive a notification every time a tab becomes active (i.e. comes to the front of another tab in the same file display).

Method Name: OnActivateTab

Argument Type:

ActivateTabData 

Return Type:

none

Description:

The ActivateTabData.oldtab property identifies the tab that was previously active, and the newtab property identifies the new active tab.