Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Switching chrome tabs not working correctly in Auto hot key

In the ahk script, i have created an action to change tabs by clicking the Xbutton1(back button) of my mouse with the scroll of the mouse. So when i press xbutton1 and scroll up or down the tabs in chrome change accordingly.

However, the issue I’m facing is, after switching the tab with xbutton1 and wheel scroll, when i release the xbutton1, its default action of going back is performed as well. how do i modify the script such that after switching the tabs and releasing xbutton1 the tab does not go back.

Also i don’t want to permanently disable the going back feature of xbutton1,
please help me, I’m new to ahk scripting, i don’t know what to do here.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

~XButton1 & WheelUp::
    Send, ^{PgUp}
    return

~XButton1 & WheelDown::
    Send, ^{PgDn}
    return

>Solution :

The tilde prefix (~) prevents AHK from blocking the XButton1 key-down/up events. It allows the key event to pass through.

If you remove ~, XButton1 loses its original function. To avoid this, make the key to send itself:

XButton1 & WheelUp::Send, ^{PgUp}

XButton1 & WheelDown::Send, ^{PgDn}

XButton1::Send, {XButton1}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading