Scripts only active when the title window is in focus?
Posted: 04 Jul 2017, 07:17
Hi. I'm working on an ahk script for a VST, hosted within a DAW (digital audio workstation). The issue is, I'm not at all sure what to use in order to only have this script active when the actual window is in focus.
I have previously used Process, Exist, Name of exe to determine the PID, but as this is a VST, hence being hosted by the DAW.exe, I'm currently unable to stop hotkeys triggering outside of the window when it's in focus.
I'm using the below function to determine this, so I can call it from other functions and scripts within the set.
StylusRMX is the title of the window, but like I say, keys still trigger no matter what window you're in on the PC.
I've looked at WinExist, WinWait, IfWinActive etc etc, but it's becoming a bit of a grey area for me. So, what's the best approach in making these scripts only active when this plugin is in focus? THX for any help Steve.
I have previously used Process, Exist, Name of exe to determine the PID, but as this is a VST, hence being hosted by the DAW.exe, I'm currently unable to stop hotkeys triggering outside of the window when it's in focus.
I'm using the below function to determine this, so I can call it from other functions and scripts within the set.
Code: Select all
GetLocation()
{
IfWinActive, StylusRMX
{
WinWaitActive, StylusRMX
blnResult:=1
}
Else
{
blnResult:=0
}
Return blnResult
}
I've looked at WinExist, WinWait, IfWinActive etc etc, but it's becoming a bit of a grey area for me. So, what's the best approach in making these scripts only active when this plugin is in focus? THX for any help Steve.