I just wondered if anybody else had tried something similar, or if there was a more direct, programmatic method to achieve this.
It uses the Acc library.
Code: Select all
#IfWinActive, ahk_class IEFrame ;internet explorer
^m:: ;internet explorer - move active tab to new window
Hotkey, IfWinActive, ahk_class IEFrame
Hotkey, ^m, Off
ToolTip, release Ctrl key
KeyWait, Ctrl
ToolTip
Hotkey, ^m, On
WinGet, hWnd, ID, A
ControlGet, hCtl, Hwnd,, TabBandClass1, % "ahk_id " hWnd
oAcc := Acc_Get("Object", "4.1.4.1", 0, "ahk_id " hCtl)
for _, oChild in Acc_Children(oAcc)
if (oChild.accChildCount = 1)
{
vTabText := oChild.accDescription(0), oTabPos := Acc_Location(oChild)
break
}
vPosX := Round(oTabPos.X + oTabPos.W / 2)
vPosY := Round(oTabPos.Y + oTabPos.H / 2)
CoordMode, Mouse, Screen
MouseGetPos, vPosX2, vPosY2
MouseClickDrag, Left, % vPosX, % vPosY, % vPosX, % vPosY-20, 0
MouseMove, % vPosX2, % vPosY2
return
#IfWinActive