QTTabBar and Folder Window functionalities are accessible via Active Scripting (wikipedia).
Script files automate operations of Tab and files.
Let's begin with creating the root object of QTTabBar scripting.
Your script communicate with QTTabBar and Folder Window through this object.
Active Tab in Active Window
var tab = window.ActiveTab;
This takes effect only when the script is executed by Command Item.