ahk script tweak für 2 instanzen

414
AMDG

Ich versuche, zwei verschiedene Hotkeys zu erstellen, die zwei unabhängige Instanzen einer Anwendung starten. Wenn der zweite geöffnet ist, wird dem Titel des Fensters ein "[2]" hinzugefügt, was für mich sehr nützlich ist. Aber es funktioniert nicht mein Code unten. Wenn ich beispielsweise die zweite Instanz öffne, wird nicht nur "[2]" nicht angezeigt, sondern auch die erste Instanz * ohne Vorwahlnummer "wird nicht gestartet.

Wie kann ich die beiden Hotkeys haben, um jedes Fenster zu öffnen, unabhängig voneinander?

#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 
0

1 Antwort auf die Frage

0
lintalist

Ihr Codeblock ist ein bisschen dran, denke ich, probiere es aus:

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 

Weitere Informationen finden Sie unter http://ahkscript.org/docs/commands/Block.htm