#IfWinActive activating K-hook and stopping listener script hotkey, unable to run without hotkeys Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

#IfWinActive activating K-hook and stopping listener script hotkey, unable to run without hotkeys  Topic is solved

Post by Noo0B » 13 Aug 2022, 04:00

Hi,
Thanks in advance for the attention.
I'm trying to get a script to send a Hotkey to another script, but apparently this listener script has K-hook hotkeys according to the script debug. I tried using #UseHook Off and changing the hotkeys (F6, F7 and F8) - F7 calls a sub - to single letters but it still shows as k-hook on the debug. The only way to remove K-hook is removing #IfWinActive from the start of the script. This line is not 100% necessary for the script but i'd still like to have it on to prevent mayhem happening with the keypresses my script sends. Also, I am unable to make the script run without a hotkey because #Warn tells me the returns and exitapps keep getting in the way.
Here are the test scripts I used. On this first one just change the ";" between lines 15 and 16 to alternate the errors I get. Adding it to line 10 make its hotkey work with the second script's input.
Here's script 1:

Code: Select all

#NoEnv
#Warn
Process, priority, , high
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2
#MaxThreadsperHotkey 2
SetBatchLines, -1
WinActivate SciTE
#IfWinActive, SciTE
#UseHook Off
F6::reload
F8::ExitApp

;F7::Gosub main
Gosub main

main:
ToolTip F7 hotkey worked!
SetTimer, RemoveTooltip, -2000
return

RemoveToolTip:
ToolTip
return
And here's 2:

Code: Select all

#NoEnv
#Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2
#MaxThreadsperHotkey 2

Send, {F7 down}
Sleep, 50
Send, {F7 up}
return
So, is there anything that can be done to use #IfWinActive and still have the k-hook off?
Also, does anyone know how I am erring running this script without a hotkey?
Thanks again,
Best wishes.


Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Re: #IfWinActive activating K-hook and stopping listener script hotkey, unable to run without hotkeys

Post by Noo0B » 18 Aug 2022, 00:03

I tested "Sendlevel 1" on the caller script and it worked.
Thanks again to Mikeyww.
Regards.

Post Reply

Return to “Ask for Help (v1)”