AutoControl Control your browser your way Forum               Install now from theChrome Web Store

Tab specifier argument


Several functions in the ACtl API receive a tabSpec argument. The purpose of this argument is to specify one or more tabs for a function to work with.
The argument's data type is defined recursively as follows:
TabSpec  =   Tab ID  |  Filter Object  |  Preset tab-selection  |  Custom tab-selection  |  Array of TabSpec

Tab ID Type: number A tab ID is a non-zero integer number that uniquely identifes a tab.
The ACtl.TAB_ID constant gives the ID of the tab the script is running in.
The ACtl.getTabIds function gives the IDs of any tab or set of tabs.
Filter object Type: Object An object with only one of the following properties: not Type: TabSpec One or more tabs to filter out. i.e. all tabs not specified here will be included. sameWinAs Type: TabSpec It includes all tabs that are in the same window (or windows) as the specified tabs. Preset tab-selection Type: string Any of the following strings, all of which start with the # character.
Tab-selections represent an ordered list of tabs. This order is usually the same as in their containing window (from left to right), unless otherwise noted.
#targetTabs The tabs given to the Run script action by the Apply to select box or by the previous action in the chain

#currentTab The active tab in the most recently focused window
#newestTab The tab that was opened most recently
#openerTab The tab that opened the #currentTab (if any)

#prevUsedTab The previously used tab in the current window
#prevUsedTabAnyWin The previously used tab in whichever window that tab is
#nextUsedTab The tab used after the current tab in the current window
#nextUsedTabAnyWin The tab used after the current tab in whichever window that tab is

#activeTabs All active tabs (one per window)
#selectedTabs All selected tabs in the current window
#hoveredTabs The tab or tabs the mouse is hovering over
#pinnedTabs All pinned tabs in the current window
#audibleTabs All audible tabs on any window
#nonMinimTabs All tabs that are in non-minimized windows

#leftTab The tab to the left of the #currentTab
#leftTabWrap The tab to the left of the #currentTab with wrap-around
#allLeftTabs All tabs to the left of the #currentTab
#leftmostTab The left-most tab in the current window

#rightTab The tab to the right of the #currentTab
#rightTabWrap The tab to the right of the #currentTab with wrap-around
#allRightTabs All tabs to the right of the #currentTab
#rightmostTab The right-most tab in the current window

#otherTabs All tabs in the current window except the active tab
#otherTabsAllWins All tabs in all windows except the current tab
#currWinTabs All tabs in the current window
#mruTabs All tabs in the current window in MRU order
#mruTabsAllWins All tabs in all windows in MRU order
#allTabs All tabs from left to right in all windows from oldest to newest
Custom tab-selection Type: string
The name of any of the custom tab selections defined by the user.
The name matching is done ignoring letter case and redundant white spaces.
Array of TabSpec Type: Array An array containing one or more TabSpec values. The resulting tab set will be the union of all tab specifiers in the array.
Example: [ ACtl.TAB_ID, '#newestTab', {not:'#selectedTabs'} ]
This gives the tab the script is running in plus the newest tab plus all tabs that are not selected.

Examples

Pin the tab the script is running in.

	ACtl.setTabState( ACtl.TAB_ID, 'pinned' ) ;
	

Open a URL in the tab to the left.

	ACtl.openURL('http://example.com', '#leftTab') ;
	

Mute all tabs that are not pinned.

	ACtl.setTabState( {not:'#pinnedTabs'}, 'muted') ;
	

Get the IDs of the current tab plus all tabs that are not in the current window.

	let tabIds = await ACtl.getTabIds( ['#currentTab', {not:'#currWinTabs'}] ) ;
	
Scripting API Script Isolation Asynchronicity Backgrnd Scripts GUI vs API ACtl.include ACtl.import ACtl.getFile ACtl.saveFile ACtl.saveURL ACtl.openURL ACtl.closeTab ACtl.runInTab ACtl.runInFrames ACtl.runInPageCtx ACtl.getTabInfo ACtl.getTabIds ACtl.TAB_ID ACtl.setTabState ACtl.captureTab ACtl.execAction ACtl.runCommand ACtl.getClipboard ACtl.setClipboard ACtl.expand ACtl.switchState ACtl.var ACtl.pubVar ACtl.on ACtl.off ACtl.sleep ACtl.STOP_CHAIN ACtl.STOP_FULL_SEQ