It works perfectly on some apps i.e. Notepad, explorer, but causes some wired behavior on others. (Opera, Chrome, VS Code)
Sometimes it does not work, but then when I move the window around and play with it (I have no idea what I did), it suddenly works. I have linked a GIF demonstration below. There was one thing I was not able to capture:
sometimes, it spawns two weird white boxes at the bottom left of my screen that I can move around. I have never seen this before.
Demonstration: https://imgur.com/a/ngH9gdU
My code:
Code: Select all
^F10::
{
{
if (A_PriorHotkey = A_ThisHotkey && A_TimeSincePriorHotkey < 300) {
SetTimer(SingleClick,0) ; Cancel the single click action
Run("C:\Users\username\AppData\Local\Programs\Opera GX\opera.exe")
} else {
SetTimer(SingleClick,-300) ; Set a timer for the single click
}
return
}
SingleClick()
{
ErrorLevel := ProcessExist("opera.exe")
if (!ErrorLevel) {
Run("C:\Users\username\AppData\Local\Programs\Opera GX\opera.exe")
} else {
state := WinGetMinMax("ahk_class Chrome_WidgetWin_1 ahk_exe opera.exe")
if (state = -1) {
WinRestore("ahk_class Chrome_WidgetWin_1 ahk_exe opera.exe")
WinActivate("ahk_class Chrome_WidgetWin_1 ahk_exe opera.exe")
} else {
WinMinimize("ahk_class Chrome_WidgetWin_1 ahk_exe opera.exe")
}
}
return
}
}