some kind of bug causing some errors?

Get help with using AutoHotkey and its commands and hotkeys
quartzz
Posts: 13
Joined: 05 Aug 2019, 05:29

some kind of bug causing some errors?

06 Oct 2019, 12:11

hey guys

so this was happening with 1.1.30.03, and also just happened with 1.1.31.00

these are 3 scripts I have

1. click.ahk - replaces mouse button with alt-gr key

Code: Select all

SetTitleMatchMode, RegEx
#IfWinActive ^(▷|.*Instagram) ahk_exe chrome.exe
RAlt::RButton
2. ctrl-w.ahk - uses the '#' key to make the active chrome window close, if conditions are met

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

SetTitleMatchMode, RegEx
#IfWinActive ^(▷|.*Instagram) ahk_exe chrome.exe
#:: ^w
3. mmbutton.ahk - makes the right control key do the same thing as pressing the mouse wheel

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

SetTitleMatchMode, RegEx
#IfWinActive ^(▷|.*Instagram) ahk_exe chrome.exe
RCtrl::MButton
-----------------------------------------
after having various combinations of these scripts active (can't remember exactly which, last time running the click.ahk script caused it)
it (poss amongst other things) disabled the keyboard, made the mouse wheel re size all desktop icons, and when I single clicked desktop icons, each click selected additional icons (rather than a new click "de-selected" the previous icon clicked)

any ideas/suggestions....?
Last edited by joedf on 06 Oct 2019, 12:17, edited 1 time in total.
Reason: code tags
User avatar
Masonjar13
Posts: 1514
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: some kind of bug causing some errors?

08 Oct 2019, 21:54

This isn't a bug with AHK. What's happening is your control is getting stuck in the "down" position. I can't exactly say where, but try using hooks first off. Second, since it's all in the same context, you should place them all in the same script. At the very least, having them all in the same script will allow you to open the ListLines and see what happened last, or where something may have gone wrong. And also, hooks probably won't work in this case if these aren't all in the same script. Scripts are not aware of other scripts running, so input produced can certainly trigger another script. There isn't anything inherently conflicting, since ^ produces LCtrl, but..

I recommend putting them all in the same script withou adding hooks. This should give you some insight as to what is happening so you can avoid it in the future. Or you can jump right to hooks, which should fix the issue. You can add a hook individually, by prefixing the hotkeys with $, #UseHook, or #InstallKeybdHook.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
quartzz
Posts: 13
Joined: 05 Aug 2019, 05:29

Re: some kind of bug causing some errors?

09 Oct 2019, 10:00

thanks some clarification needed
Masonjar13 wrote:
08 Oct 2019, 21:54
This isn't a bug with AHK. What's happening is your control is getting stuck in the "down" position.
you mean the control key?
I can't exactly say where, but try using hooks first off.
what are hooks, and how to turn them off?
Second, since it's all in the same context, you should place them all in the same script.
(not sure what you mean by the same context?) but so I can place all the code in a single script rather than 3 seperate?
can I use the ; character to "disable" parts of the script from running
At the very least, having them all in the same script will allow you to open the ListLines and see what happened last, or where something may have gone wrong.
again, sorry, what is listlines?
And also, hooks probably won't work in this case if these aren't all in the same script. Scripts are not aware of other scripts running, so input produced can certainly trigger another script. There isn't anything inherently conflicting, since ^ produces LCtrl, but..
each script uses different keys, so shouldn't conflict? (alt-gr key, right control, and hash key)
I recommend putting them all in the same script withou adding hooks.
ok?
This should give you some insight as to what is happening so you can avoid it in the future.
will the insight become apparent when I see it? :)
Or you can jump right to hooks, which should fix the issue. You can add a hook individually, by prefixing the hotkeys with $, #UseHook, or #InstallKeybdHook.
ok again that sentence is greek to me right now, I'm not sure what a hook is, and i'm not sure what prefixing a hotkey is (and I'm not sure what a hotkey is yet?)

all I know at the moment is the ahk script remaps one keyboard press, to another function

thanks for your info on this
User avatar
Masonjar13
Posts: 1514
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: some kind of bug causing some errors?

09 Oct 2019, 18:40

I'm going to assume you didn't write these then? With that many questions, I would direct you to the tutorial. That should clear up most of your questions, and probably better than I could explain here.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
quartzz
Posts: 13
Joined: 05 Aug 2019, 05:29

Re: some kind of bug causing some errors?

10 Oct 2019, 10:14

the last line of each script (basically a remap, same as sharpkey does - except sharpkey doesn't cover mouse buttons) I wrote, but I needed the remaps to only be active under certain chrome webpage conditions ("if text isin url"), someone here gave me the settitlematchmode and ifwinactive lines

the tutorial...is............very......indecipherable? it's 9 lines of script, and 6 of those lines are identical, how difficult can it be? :) (also, all 3 scripts [didn't realise they could be amalgamated], do 'sometimes' all work together? bit unpredictable?)

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Wigi and 149 guests