From 87bbbcf9261bc2a30a4f2e2383833b23ffcf4196 Mon Sep 17 00:00:00 2001 From: g0nzo83 <83645983+g0nzo83@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:46:43 +0100 Subject: [PATCH] Bugfix in Hotkeygroups --- Main.ahk | 4 ++-- src/Main_Class.ahk | 24 +++++++++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Main.ahk b/Main.ahk index e012db9..680080a 100644 --- a/Main.ahk +++ b/Main.ahk @@ -26,7 +26,7 @@ A_MaxHotKeysPerInterval := 10000 TODO ######################### */ -;@Ahk2Exe-Let U_version = 1.0.1. +;@Ahk2Exe-Let U_version = 1.0.2. ;@Ahk2Exe-SetVersion %U_version% ;@Ahk2Exe-SetFileVersion %U_version% ;@Ahk2Exe-SetCopyright gonzo83 @@ -68,7 +68,7 @@ Load_JSON() { DJSON, JSON.Load(FileRead("EVE-X-Preview.json")) ) - FileDelete("EVE-X-Preview.json") + FileDelete("EVE-X-Preview.json") FileAppend(JSON.Dump(_JSON,," " ), "EVE-X-Preview.json") } catch as e { diff --git a/src/Main_Class.ahk b/src/Main_Class.ahk index 3780769..2d16427 100644 --- a/src/Main_Class.ahk +++ b/src/Main_Class.ahk @@ -223,7 +223,7 @@ Class Main_Class extends ThumbWindow { if(This.Global_Hotkeys) { if( v["ForwardsHotkey"] != "" ) { Fkey := v["ForwardsHotkey"], Arr := v["Characters"] - HotIf (*) => This.OneWinExist(Arr) && !WinActive("EVE-X-Preview - Settings") + HotIf ObjBindMethod(This, "OnWinExist", Arr) try { Hotkey( v["ForwardsHotkey"], ObjBindMethod(This, "Cycle_Hotkey_Groups",Arr,"ForwardsHotkey"), "P1") } @@ -233,7 +233,7 @@ Class Main_Class extends ThumbWindow { } if( v["BackwardsHotkey"] != "" ) { Fkey := v["BackwardsHotkey"], Arr := v["Characters"] - HotIf (*) => This.OneWinExist(Arr) && !WinActive("EVE-X-Preview - Settings") + HotIf ObjBindMethod(This, "OnWinExist", Arr) try { Hotkey( v["BackwardsHotkey"], ObjBindMethod(This, "Cycle_Hotkey_Groups",Arr,"BackwardsHotkey"), "P1") } @@ -246,7 +246,7 @@ Class Main_Class extends ThumbWindow { else { if( v["ForwardsHotkey"] != "" ) { Fkey := v["ForwardsHotkey"], Arr := v["Characters"] - HotIf (*) => This.OneWinExist(Arr) && WinActive("Ahk_exe exefile.exe") + HotIf ObjBindMethod(This, "OnWinActive", Arr) try { Hotkey( v["ForwardsHotkey"], ObjBindMethod(This, "Cycle_Hotkey_Groups",Arr,"ForwardsHotkey"), "P1") } @@ -256,7 +256,7 @@ Class Main_Class extends ThumbWindow { } if( v["BackwardsHotkey"] != "" ) { Fkey := v["BackwardsHotkey"], Arr := v["Characters"] - HotIf (*) => This.OneWinExist(Arr) && WinActive("Ahk_exe exefile.exe") + HotIf ObjBindMethod(This, "OnWinActive", Arr) try { Hotkey( v["BackwardsHotkey"], ObjBindMethod(This, "Cycle_Hotkey_Groups",Arr,"BackwardsHotkey"), "P1") } @@ -281,7 +281,7 @@ Class Main_Class extends ThumbWindow { if (Index > length) Index := 1 - if (This.OneWinExist(Arr)) { + if (This.OnWinExist(Arr)) { Try { if !(WinExist("EVE - " This.CleanTitle(Arr[Index]))) { while (!(WinExist("EVE - " This.CleanTitle(Arr[Index])))) { @@ -301,7 +301,7 @@ Class Main_Class extends ThumbWindow { if (Index <= 0) Index := length - if (This.OneWinExist(Arr)) { + if (This.OnWinExist(Arr)) { if !(WinExist("EVE - " This.CleanTitle(Arr[Index]))) { while (!(WinExist("EVE - " This.CleanTitle(Arr[Index])))) { Index -= 1 @@ -323,13 +323,19 @@ Class Main_Class extends ThumbWindow { } ; To Check if atleast One Win stil Exist in the Array for the cycle groups hotkeys - OneWinExist(Arr, *) { + OnWinExist(Arr, *) { for index, Name in Arr { - If WinExist("EVE - " Name " Ahk_Exe exefile.exe") + If ( WinExist("EVE - " Name " Ahk_Exe exefile.exe") && !WinActive("EVE-X-Preview - Settings") ) { return true + } } return false - + } + OnWinActive(Arr, *) { + If (This.OnWinExist(Arr) && WinActive("Ahk_exe exefile.exe")) { + return true + } + return false } ;## Updates the Thumbnail in the GUI after Activation