I try to add some functinality to a larger script of mine.
I am new to using PID's, but Forum questions/answers and the user manual helped me halfway.
I can't seem to find a solution for the WinActivate part though.
This is the simplified version of my script:
Ctrl_Win_F11 runs two instances of Chrome, at the same time I retrieve the corresponding PID's.
Later on I want to activate one of these Chrome windows (they are on two monitors), making use of the retrieved PID's.
Ctrl_Win_F12 Messagebox shows the correct PID, but WinActivate doesn't activate the corresponding Chrome window.
No idea.
Any help or tip is highly appreciated.
Thx,
Tup
Code: Select all
#SingleInstance force
#NoEnv
Chrome1PID := 0
Chrome2PID := 0
^#F11::
Run, C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe https://calendar.google.com/calendar/u/0/r/week,,, Chrome1PID
Sleep, 1000
;just to check:
MsgBox, % Chrome1PID
Run, C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe --new-window https://web.whatsapp.com/,,, Chrome2PID
Sleep, 1000
;just to check:
MsgBox, % Chrome2PID
return
^#F12::
;just to check:
MsgBox, % Chrome2PID
WinActivate, ahk_pid %Chrome2PID%,
return