[AHK]为TC的标签关闭与恢复设置热键

ctrl+w关闭当前标签

ctrl+n 恢复刚关闭的标签

;准备在哪个面板恢复Tab,可以根据鼠标判断,也可以根据激活面板判断,自行调整


#IfWinActive ahk_class TTOTAL_CMD
^w::
	ClipboardBackup = %ClipboardAll%
	PostMessage, 1075, 2029, , , ahk_class TTOTAL_CMD ;复制来源路径
	Send ^w
	IfNotEqual,TC_History_Array%TC_History_ArrayCount% , %Clipboard%
	{
		TC_History_ArrayCount += 1
		TC_History_Array%TC_History_ArrayCount% = %Clipboard%
	}
	Clipboard = %ClipboardBackup%
	ClipboardBackup =
	Return

^n::
	If (TC_History_ArrayCount>0)
	{
		TC_History_temp:=TC_History_Array%TC_History_ArrayCount%
		IfExist ,%TC_History_temp%
		{
			flag_leftofright:=Tc_mouse_leftorRight()
			if flag_leftofright=右侧
			{
				Run D:\CopperMiner\文件管理\Totalcmd\totalcmd\TOTALCMD.EXE  /O  /T  /R=%TC_History_temp% ;应该用内部命令方式发送更合理,谁知道命令是什么不?
			}
			Else
			{
				Run D:\CopperMiner\文件管理\Totalcmd\totalcmd\TOTALCMD.EXE  /O  /T  /L=%TC_History_temp%
			}
		}
		TC_History_ArrayCount -= 1
	}
	Return
#IfWinActive

Tc_Act_leftorRight()
{
	ControlGetFocus,_ctl,ahk_class TTOTAL_CMD
	ControlGetPos ,x,y,,,%_ctl%,ahk_class TTOTAL_CMD
	ControlGetPos,xp,yp,,,TPanel1,ahk_class TTOTAL_CMD
	If( x>xp)    ;如果你也用上下面板模式(好像有这个模式),可以加入y的判断
		Return "右侧"
}
Tc_mouse_leftorRight()
{
	MouseGetPos,x,y,
	ControlGetPos,xp,yp,,,TPanel1,ahk_class TTOTAL_CMD
	If( x>xp) ;如果你也用上下面板模式(好像有这个模式),可以加入y的判断
		Return "右侧"
}

猜你喜欢

转载自blog.csdn.net/liuyukuan/article/details/81676411
AHK