我正在尝试创建两个不同的热键来启动应用程序的两个独立实例。当第二个打开时,在窗口的标题上添加“ [2]”,这对我来说非常有用。但这不起作用我下面的代码。例如,当我打开第二个实例时,不仅不会出现“ [2]”,而且第一个实例“没有预编号”也不会启动。
我如何才能使用两个热键在一个窗口中打开每个窗口,而又彼此不依赖?
#1::
IfWinExist Total Commander (x64) 8.51a - NP
{
WinWait Total Commander (x64) 8.51a - NP
WinActivate
}
else
Run c:\Program Files\Total Commander\TOTALCMD64.EXE,,Max
{
WinWait Total Commander (x64) 8.51a - NP
WinActivate
}
Return
#2:: ; application title should show [2] weather the other is opened or not ; corrected indentation here
IfWinExist [2] Total Commander (x64) 8.51a - NP
{
WinWait [2] Total Commander (x64) 8.51a - NP
WinActivate
}
else
Run c:\Program Files\Total Commander\TOTALCMD64.EXE,,Max
{
WinWait [2] Total Commander (x64) 8.51a - NP
WinActivate
}
Return
我认为您的代码块有点过时,请尝试以下操作:
tc_title:="Total Commander (x64) 8.51a"
tc_path:="c:\Program Files\Total Commander\TOTALCMD64.EXE"
#1::
IfWinExist %tc_title%
{
WinActivate %tc_title%
}
else IfWinNotExist %tc_title%
{
Run %tc_path%,,Max
WinWait %tc_title%
WinActivate
}
Return
#2::
IfWinExist [2] %tc_title%
{
WinActivate [2] %tc_title%
}
else IfWinNotExist [2] %tc_title%
{
Run %tc_path%,,Max
WinWait [2] %tc_title%
WinActivate
}
Return
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句