Runing an auto detection test for the active window with this script. Notepad no issue with it being detected and and all the mapings and macros work flawlessly. This is also true if I activate the game keyboard profile/mappings manually with a hotkey.
With Winactive method for my game its as if though the line #HotIf WinActive("ahk_exe FutureWar_W10.exe") fails to detect the game window. The game is from Microsoft store and the executable FutureWar_W10.exe is In the C:\Program Files\WindowsApps\A278AB0D.ModernCombatFutureWar_66.0.7.0_x64__h6adky7gbf63m folder. The game window title bar displays "Sniper Fury". Might be worth noting that I cant run it by clicking the executable in its folder, only by the game installed icon. I added a couple shots of the game in task manager, showing the titles and PID. To me it all seems to be correct.
What am I doing wrong? What are the possible solutions to make this #HotIf work?
Code: Select all
#Requires AutoHotkey v2.0
#HotIf WinActive("ahk_exe FutureWar_W10.exe")
t::1
g::2
d::3
e::4
$f::Send("{f down}"), Sleep(20), Send("{f up}"), Sleep(20), Send("{f down}"), Sleep(20), Send("{f up}"), Sleep(20), Send("{f down}"), Sleep(20), Send("{f up}"), Sleep(20), Send("{r down}"), Sleep(20), Send("{r up}"), Sleep(20), Send("{r down}"), Sleep(20), Send("{r up}"), Sleep(20), Send("{r down}"), Sleep(20), Send("{r up}"), Sleep(20) ; jump and reload macro
#HotIf WinActive("ahk_class Notepad")
$F1::SendText("Hi, this is a F1 SendText")
$F2::SendText("Hi, this is a F2 SendText")
$F3::SendText("Hi, this is a F3 SendText")
t::1
g::2
d::3
e::4
$f::Send("{f down}"), Sleep(20), Send("{f up}"), Sleep(20), Send("{f down}"), Sleep(20), Send("{f up}"), Sleep(20), Send("{f down}"), Sleep(20), Send("{f up}"), Sleep(20), Send("{r down}"), Sleep(20), Send("{r up}"), Sleep(20), Send("{r down}"), Sleep(20), Send("{r up}"), Sleep(20), Send("{r down}"), Sleep(20), Send("{r up}"), Sleep(20) ; macro
[Mod edit: [code][/code] tags added. Please use them yourself when posting code.]
https://photos.app.goo.gl/f76XZCjWnZKsykxV6
https://photos.app.goo.gl/MnzPeTLz8gRnQ2CWA
[Mod edit: Removed img-tags. You can only use them with direct links.]