Scripting with QTTabBar
Table of Contents

Script Samples
List of ScriptingCommands
C# scriptng


Scripting Object

Provides access to root object for the QTTabBar scripting.

 (js)        var qs = new ActiveXObject( "QTTabBarLib.Scripting" );

(vbs)        Set qs = CreateObject("QTTabBarLib.Scripting")

Properties

ActiveWindow

Returns a Window object that represents an active Explorer window.

Arguments

Returns a QCollection object that contains command line strings.
(New in 1024)

CurrentDirectory

Returns current directory path.
(New in 1025)

FocusedWindow

Returns a Window object or Desktop object that currently has keyboard focus.
Null, if other application or window has the focus.
(New in 261)

DesktopWindow

Returns Desktop object that represents the desktop view.
(New in 261)

Windows

Returns a QCollection object that contains all Explorer windows as Window object.

Methods

Alert( object, [window] )

Outputs text to a message box window.

object Text string to be displayed in the alert box.
window (optional) A Window object on which the alert box is displayed. The alert box is modal to the window if specified.
MessageBox( text, [buttons], [icon], [window] )

Outputs text to a message box window specifying buttons and icon.

text Text string to be displayed in the message box.
buttons (optional) A MessageBoxButton value that specifies which button or buttons to display.
The value can be a string such as "OK", or its underlying integer value 0.
icon (optional) A MessageBoxIcon values that specifies which icon to display in the message box.
The value can be a string such as "Error", or its underlying integer value 16.
window (optional) A Window object on which the message box is displayed. The message box is modal to the window if specified.
 
Return Value A DialogResult value.
InputBox( text, [defaultText], [fPassword], [window] )

Outputs text to a message box window and provides a text field in which the user can type an answer in response.

text Text string to be displayed in the InputBox.
defaultText (optional) Text string to be set in the text box.
fPassword (optional) A Boolean value indicating whether the text should appear as the password character.
window (optional) A Window object on which the input box is displayed. The input box is modal to the window if specified.
 
Return Value Text value that user typed if OK button is pressed. Otherwise null.
MessageForm( text, [duration], [icon], [window] )

Outputs text to a modal message box window for specified duration time. (New in 261)

text Text string to be displayed in the message box.
duration (optional) The length of time for which this message box is displayed, in msec. Default value is 10000 (10seconds).
icon (optional) A MessageBoxIcon values that specifies which icon to display in the message box.
The value can be a string such as "Error", or its underlying integer value 16.
window (optional) A Window object on which the message box is displayed. The message box is modal to the window if specified.
GetFolderPath( folder )

Gets the path to the system special folder.

folder An enumerated constant that identifies a system special folder.
See MSDN
The value can be a string such as "ApplicationData", or its underlying integer value 26.
 
Return Value a path string to the system special folder.
GetSystemInformation( name )

Provides information about the current system environment.

name A name of system information to get.
See MSDN.
The value can be a valid property name string such as "ActiveWindowTrackingDelay".
InvokeCommand( command, [arg1], [arg2], … )

Invokes QTTabBar command.

command ScriptingCommand enumeration value. See ScriptingCommands.
This method accepts non-window commands.
The value can be a string such as "NewWindow", or its underlying integer value 5.
See also Window.InvokeCommand.
 
arg Command-specific arguments. For more information, see the description for each command. If the command does not require arguments, they can be omitted.
 
Return Value A command-specific value.
NewCollection()

Provides a new empty QCollection object.

NewCollectionFromItems( obj1, obj2, … )

Provides a new QCollection object containing arguments.

Open( path, [view] )

Opens a new tab.

path path string to a folder to open.
view (optional) View where the tab is to be opened. (1024)
Return Value Window object
OpenWindow( path, [view] )

Opens a new window.

path path string to a folder to open.
view (optional) View where the tab is to be opened. (1024)
Return Value Window object
OpenGroup( group, [view] )

Opens group(s) of QTTabBar.

group a group name string to open or a QCollection object that contains group names.
view (optional) View where the tab is to be opened. (1024)
Return Value Window object
OpenGroupWindow( group, [view] )

Opens group(s) of QTTabBar in new explorer window.

group a group name string to open or a QCollection object that contains group names.
view (optional) View where the tab is to be opened. (1024)
Return Value Window object
CloseAllWindows()

Tries to close all the Explorer windows.

Sleep( msec )

Suspends the current thread for a specified time.

msec The number of milliseconds for which the thread is blocked.
1000msec is 1 second, as you know!
GetEventData( eventDataKey )

Gets event data when the scripting process starts by Explorer event.

eventDataKey Key to get data. This is passed as a command line argument to the script process replacing a token %eventdata_key%.
Return value Event specific data. Tab object, text string, etc.
GetEventSource( eventDataKey )

Gets source event kind when the scripting process starts by Explorer event.

eventDataKey Key to get data. This is passed as a command line argument to the script process replacing a token %eventdata_key%.
Return value EventSource value.
GetEventTargetView( eventDataKey )

Gets event source view when the scripting process starts by Explorer event.

eventDataKey Key to get data. This is passed as a command line argument to the script process replacing a token %eventdata_key%.
Return value View where the event occured.
GetEventSourceString( eventDataKey )

Gets source event name when the scripting process starts by Explorer event.

eventDataKey Key to get data. This is passed as a command line argument to the script process replacing a token %eventdata_key%.
Return value Name of the event.
GetEventKeyState( eventDataKey )
SetReturn( value )

Returns a value to scripting host.

value Object to return.

Window Object

Represents an Explorer window.

Properties

Active

Gets or sets a value indicating whether the window is on the foreground and has focus.
(New in 261)

ActiveTab

Returns a Tab object that represents an active tab in the window.
*The tab might be a virtual tab when no tabbars are enabled. (1024)
*The tab might be in Extra view bar. (1024)

ActiveView

Returns an active View in the window.
(New in 1024)

Tabs

Returns a QCollection object that contains all the tabs in the default view of the window.
*This property returns tabs of Default view. If you want to get tabs in extra views, use GetTabs method or AllTabs prorperty. (1024)

AllTabs

Returns a QCollection object that contains all the tabs in the window, including of enabled Extra View Bars.
(New in 1024)

Text

Returns window title text.

SelectedItems

An alias property of .ActiveTab.SelectedItems.
(New in 261)

Path

An alias property of .ActiveTab.Path.
(New in 512)

Methods

InvokeCommand( command, [arg1], [arg2], [arg3], … )

Invokes QTTabBar command.

command ScriptingCommand enumeration value. See ScriptingCommands.
The value can be a string such as "GoBack", or its underlying integer value 0.
 
arg1, arg2, arg3 Command-specific arguments. For more information, see the description for each command.
 
Return Value A command-specific value.
Add( path, [view] )

Adds a new tab to the window.

path path string of a folder.
view (optional) View where the tab is to be opened. (1024)
Return Value Tab object.
Insert( path, [index], [activate], [new], [view] )

Inserts a new tab to the window at the specified index.

path path string of a folder.
index (optional) The zero-based index at which tab should be inserted.
activate (optional) A value indicating whether a new tab is activated.
new (optional) A value indicating whether a new tab is inserted even if path already exists as a tab.
view (optional) View where the tab is to be opened. (1024)
Return Value Tab object.
IndexOfID( id )

Determines the index of a specific tab in the window.

id ID value of Tab object.
Return Value The index of tab if found in the window; otherwise, -1.
TabFromID( id )

Gets the tab from ID value.

id ID value of the tab.
Return Value Tab object.
Close()

Tries to close the window.

GetTabs( view )

Returns a QCollection object that contains all the tabs in the specified view.

view View enumeration.
Return Value QCollection object.
GetData( [slot] )

Gets saved data in the slot. This is equivalent to Window.InvokeCommand( "GetData" ).

slot Data slot number. 0 if omitted.
Return value Data saved previously.
SetData( data, [slot] )

Sets data in the slot. This is equivalent to Window.InvokeCommand( "SetData" ).

data Data to save.
slot Data slot number. 0 is passed if omitted.

Tab Object

Represents a tab.

Properties

Active

Gets or sets a value indicating whether the tab is active.
Returns True if the tab this object represents is active.
Setting this property true, then the tab becomes active.

ID

Returns a value which uniquely identifies the tab in the window.

Locked

Gets or sets a value indicating whether the tab is locked.
Returns True if the tab this object represents is locked.

Path

Gets or sets a path string of the tab.

SelectedItems

Gets or sets selected items in the folder view of the tab.
QCollection object that contains names or full paths.

var newSel = qs.NewCollection();
newSel.Push( "Program Files" );
newSel.Push( "Windows" );

tab.SelectedItems = newSel;

From 1026, the following code is acceptable, which sets single file name directly.
tab.SelectedItems = "Windows";        // this can be full path "C:\\Widnows"
SelectedFolders

Gets selected folders in the folder view of the tab as QCollection object.
(New in 1024)

SelectedFiles

Gets selected files in the folder view of the tab as QCollection object.
(New in 1024)

Text

Returns tab title text.

View

View enumeration that this tab represents.
(New in 1024)

Window

Gets a parent Window object of the tab.

Methods

Close()

Tries to close the tab.

GoBack()

Navigates backward one item in the history list of the tab.

GoForward()

Navigates forward one item in the history list of the tab.

NavigateTo( path )

Navigates the tab to the specified folder.

path path string of a folder.
Return Value True if successful.

QCollection Object

Represents a object collection. This is similar to Array object of javascript.

Properties

Count

Gets the number of objects in the collection.

Length

An alias of Count property. (New in 261)

Methods

Item( index )

Gets the object at the specified index.

index The index of object to retrieve from the collection. 0 is implied if omitted.
Return Value object.
IndexOf( object )

Searches for the specified object and returns the index of the first occurrence within the collection.

object Object value.
Return Value The index of the specified object if found in the collection; otherwise, -1.
LastIndexOf( object )

Searches for the specified object and returns the index of the last occurrence within the collection.

object Object value.
Return Value The index of the specified object if found in the collection; otherwise, -1.
Push( object )

Appends new elements to a collection, and returns the new count of the collection.

object An object to be added.
Return Value New number of objects in the collection.
Add( object )

An alias of Push method. (New in 261)

Pop()

Removes the last element from a collection and returns it.

Return Value A object that was at the last of the collection.
Shift()

Removes the first element from a collection and returns it.

Return Value A object that was at the first of the collection.
Unshift( object )

Inserts new elements to a collection at the beginning, and returns the new count of the collection.

object An object to be inserted.
Return Value New number of objects in the collection.
Concat( qcollection )

Returns a new QCollection consisting of a combination of two QCollections.

qcollection A QCollection object to be added.
Return Value New QCollection object.
Join( delimiter )

Returns a string value consisting of all the elements of a collection concatenated together and separated by the specified separator character.

delimiter A String object used to separate one element of an collection from the next in the resulting String object.
If null, the elements are separated with a comma.
Return Value Concatenated string
Reverse()

Reverse the collection.

Return Value QCollection itself.
Slice( start, [end] )

Returns a section of a collection.

start The index to the beginning of the specified portion of the collection.
end (optional) The index to the end of the specified portion of the collection.
Return Value New QCollection object copied up to, but not including, the element indicated by end.
Sort()

Sort the collection.

Return Value QCollection itself.
Expand( mode )

Similar to Join(), returns a string value concatenated and separated by the some kinds of separators.

mode Indicates how the concatenation is done.
0 - Double quoted and separated by a white space. ex. "a" "b" "c"….
Return Value Concatenated string.

Desktop Object

Represents an Desktop view.

Properties

Active

Gets or sets a value indicating whether the desktop window has focus..
Returns True if the desktop has keyboad focus.
Setting this property true, then the desktop becomes active.

SelectedItems

Gets or sets selected items in the desktop view.
QCollection object.

Text

Returns a text string represents desktop.

Methods

InvokeCommand( command, [arg1], [arg2], [arg3] )

Invokes QTTabBar command to the desktop.

command ScriptingCommand enumeration value. See ScriptingCommands.
The value can be a string such as "GoBack", or its underlying integer value 0.
 
arg1, arg2, arg3 Command-specific arguments. For more information, see the description for each command.
 
Return Value A command-specific value.