Hey @az22c,
This is a complex problem and what worked years ago on Sierra no longer works in later versions of macOS.
I took a shot at the problem, but I'm still on Sierra and can't make certain it works on High Sierra or later. Maybe @JMichaelTX will test these for me at least on Mojave.
There are 5 macros that handle tabs 1-5. (Of course you can add more if needed.)
The sort code in the AppleScript is courtesy of @ComplexPoint on the LNS forum:
Download the file and double-click it in the Finder to install.
-Chris