一键拖动生成快速启动

一键拖动生成快速启动

一键拖动生成快速启动工具栏

^#x:: ;自动添加快速启动工具栏
if had_added()
ExitApp ql_add()
Sleep,
if (is_locked())
{
lock_unlock()
}
Sleep,
clear()
Sleep,
control_move()
control_set()
Sleep,
lock_unlock()
blockinput,off ;===================================================== ql_add()
{ winactivate,ahk_class Shell_TrayWnd
WinGetPos, x, y, w, h, ahk_class Shell_TrayWnd
ControlClick, % "x" " y" h, ahk_class Shell_TrayWnd,, R
blockinput,on
while(!menu1_hwnd := waitmenu(click_x, click_y))
Sleep,
ControlSend, ahk_parent, t, ahk_id %menu1_hwnd%
ControlSend, ahk_parent, {Right}, ahk_id %menu1_hwnd%
WinGetPos, m1x, m1y, m1w, m1h, ahk_id %menu1_hwnd%
while(!menu2_hwnd := waitmenu(m1x+m1w, m1y, menu1_hwnd))
Sleep,
ControlSend, ahk_parent,n, ahk_id %menu2_hwnd%
WinWait, 新工具栏 - 选择文件夹
ControlClick, Edit1, 新工具栏 - 选择文件夹,, L
ControlSetText, Edit1, %APPDATA%\Microsoft\Internet Explorer\Quick Launch, 新工具栏 - 选择文件夹
ControlSend, Edit1, {Enter}, 新工具栏 - 选择文件夹
ControlClick, Button1, 新工具栏 - 选择文件夹
ControlGetPos,xs,ys,,,Button1,新工具栏 - 选择文件夹 Loop
{ IfWinExist, 新工具栏 - 选择文件夹
{
WinActivate,新工具栏 - 选择文件夹
MouseMove,xs+,ys+,
Send {LButton}
}
else
{
break
}
Sleep,
}
} is_locked()
{
RegRead, Status, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, TaskbarSizeMove
return !Status
} lock_unlock()
{
WinGetPos, x, y, w, h, ahk_class Shell_TrayWnd
ControlClick,% "x" x " y" y+h, ahk_class Shell_TrayWnd,, R
while(!Menu_hwnd := waitmenu(Click_x, Click_y))
Sleep,
ControlSend, ahk_parent, l, ahk_id %Menu_hwnd%
}
clear()
{
WinGet, ctr_list, ControlList, ahk_class Shell_TrayWnd
Loop, Parse, ctr_list, `n, `r
{
if InStr(A_LoopField,"ToolbarWindow32")
{
ControlGetText, txt, % A_LoopField, ahk_class Shell_TrayWnd
if (txt="Quick Launch")
{
ql_ctr := A_LoopField
break
}
}
}
if ql_ctr
{
ControlGet, ql_ctr_hwnd, Hwnd, , % ql_ctr, ahk_class Shell_TrayWnd
WinGetPos, x, y, w, h, ahk_id %ql_ctr_hwnd%
ControlClick, % "x" " y" h, ahk_id %ql_ctr_hwnd%,, R
while(!Menu1_hwnd := waitmenu(x, y+h))
Sleep,
ControlSend, ahk_parent, v, ahk_id %Menu1_hwnd%
ControlSend, ahk_parent, {Right}, ahk_id %Menu1_hwnd%
WinGetPos, m1x, m1y, m1w, m1h, ahk_id %Menu1_hwnd%
while(!Menu2_hwnd := waitmenu(m1x+m1w, m1y, Menu1_hwnd))
Sleep,
ControlSend, ahk_parent, g, ahk_id %Menu2_hwnd%
WinWaitClose, ahk_id %Menu2_hwnd% WinGetPos, x, y, w, h, ahk_id %ql_ctr_hwnd%
ControlClick, % "x" " y" h, ahk_id %ql_ctr_hwnd%,, R
while(!Menu3_hwnd := waitmenu(x, y+h))
Sleep,
ControlSend, ahk_parent, x, ahk_id %Menu3_hwnd%
WinWaitClose, ahk_id %Menu3_hwnd% WinGetPos, x, y, w, h, ahk_id %ql_ctr_hwnd%
ControlClick, % "x" " y" h, ahk_id %ql_ctr_hwnd%,, R
while(!Menu4_hwnd := waitmenu(x, y+h))
Sleep,
ControlSend, ahk_parent, w, ahk_id %Menu4_hwnd%
WinWaitClose, ahk_id %Menu4_hwnd%
}
} control_move()
{
Loop,
{
ControlGetPos,x2,y2,,,MSTaskListWClass1,ahk_class Shell_TrayWnd
ControlGetPos,x,y,,,ToolbarWindow323,ahk_class Shell_TrayWnd
if (x>x2)
{
WinActivate,ahk_class Shell_TrayWnd
MouseMove,x-,y+,
Send {LButton down}
Sleep,
MouseMove,,y+,
Send {LButton up}
}
else
{
break
}
}
} control_set()
{
blockinput,on
WinActivate,ahk_class Shell_TrayWnd
ControlGetPos,x,y,w,h,ToolbarWindow323,ahk_class Shell_TrayWnd
ControlGetPos,x2,y2,,,MSTaskListWClass1,ahk_class Shell_TrayWnd
MouseMove,x+w+(x2-x-w)*/,h/,
Send {LButton down}
Sleep,
ControlGetPos,,,w0,h,ToolbarWindow323,ahk_class Shell_TrayWnd
wc:=w0/
mousemove,-wc,,,r
con:=
loop
{
if (wc<)
{
break
}
wc:=wc/
ControlGetPos,,,w,h,ToolbarWindow323,ahk_class Shell_TrayWnd
if ((w0-wc*>w)and(con=))
{
con:= }
else if ((w0-wc*=w)and(con=))
{
con:=
}
else if ((w0+wc*<w)and(con=))
{
con:= }
else if ((w0-wc*=w)and(con=))
{
con:=
} if (con=)
{
w0:=w
mousemove,-wc,,,r
}
else
{
w0:=w
mousemove,wc,,,r
} }
Send {LButton up}
blockinput,off
} had_added(){
WinGet, ctr_list, ControlList, ahk_class Shell_TrayWnd
Loop, Parse, ctr_list, `n, `r
{
if InStr(A_LoopField,"ToolbarWindow32")
{
ControlGetText, txt, % A_LoopField, ahk_class Shell_TrayWnd
if (txt="Quick Launch")
{
ql_ctr := A_LoopField
break
}
}
}
if ql_ctr
return
} waitmenu(click_x, click_y, ex_hwnd:="")
{
WinGet, wins, List
a := ""
Loop % wins
{
win := wins%A_index%
WinGetPos, x, y, w, h, ahk_id %win%
WinGetTitle, title, ahk_id %win%
if (!title && (Abs(Click_y-y)< || Abs(Click_y-(y+h))<) && w< && w> && h> && (ex_hwnd ? win<>ex_hwnd : ))
{
return win
}
}
}
05-11 19:24