$lactivecid
From Scriptwiki
Returns the connection id of the last active window.
$lactivecid
See Also
To get the connection if of the currently active window, look at $activecid.
To react on windows changes, look at the On active event.