Hotkeys not working

Get help with using AutoHotkey and its commands and hotkeys
sinbad
Posts: 40
Joined: 01 Mar 2018, 09:32

Hotkeys not working

08 Feb 2019, 11:59

Hello

I have a long script and at the very end I have

Code: Select all

^r::Reload
But it isn't working :facepalm:

Why can that be?
Last edited by sinbad on 09 Feb 2019, 11:09, edited 1 time in total.
User avatar
Scr1pter
Posts: 1220
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Reload not working

08 Feb 2019, 12:09

Hi,

Difficult to answer due to little information about your script.
Some questions/ideas:

1)
So this means nothing happens when you press Ctrl+R, right?

2)
If you replace reload by ExitApp, is it still the same?

3)
Do you work with #if blocks?

4)
Is any loop running?

Cheers!
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: G502 FE, Jelly Comb Touchpad - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.32.00
gregster
Posts: 5837
Joined: 30 Sep 2013, 06:48

Re: Reload not working

08 Feb 2019, 12:15

Best guess: Add a little sleep to your loops.
User avatar
Hellbent
Posts: 1194
Joined: 23 Sep 2017, 13:34

Re: Reload not working

09 Feb 2019, 03:17

Could be as simple as your script is sending keystrokes and thus you just need to add a * to your reload hotkey so that it fires regardless of any other keys being pressed.

But you did say that the reload hotkey wasn't working and not that it sometimes works and other times it doesn't so this is probably not the reason.
Just a shot in the dark.

Code: Select all

*^r::Reload
sinbad
Posts: 40
Joined: 01 Mar 2018, 09:32

Re: Reload not working

09 Feb 2019, 08:43

Thanks @Hellbent, @gregster and @scr1pter I will work through your suggestions later today.
sinbad
Posts: 40
Joined: 01 Mar 2018, 09:32

Re: Reload not working

09 Feb 2019, 09:00

The culprit was in some code I borrowed from github, it has

Code: Select all

SetTimer, EnableButtonSetup, 1
This is constantly checking the content of Gui edit boxes and enabling or disabling buttons. There must be a better way to do this?
sinbad
Posts: 40
Joined: 01 Mar 2018, 09:32

Re: Reload not working

09 Feb 2019, 09:18

I may have spoken too soon. Having removed the SetTimer, my script still does not react to hotkeys. I tried the following and none had any affect.
^r::Reload
esc::ExitApp
F1::Reload

So I will keep looking...
sinbad
Posts: 40
Joined: 01 Mar 2018, 09:32

Re: Reload not working

09 Feb 2019, 10:48

I think this is the #if is the problem. If I want to rewrite this inside of a function how could I do that? I keep getting an error that this is not allowed inside functions....

Code: Select all

#if WinActive(gui_title)
        ^c::
        send {AppsKey}c
        GuiControl, 1:, AuthCode, %clpbrd%

        If pwb !=
          ObjRelease(WEB)
        Gui, 2:destroy
        GuiControl, 1:+ReadOnly, ClientId
        GuiControl, 1:+ReadOnly, ClientSecret
    return

Return to “Ask For Help”

Who is online

Users browsing this forum: Arsonistic, paul1965, roysubs and 57 guests