Jump to content

HotkeySet - Mouse buttons


 Share

Go to solution Solved by mikell,

Recommended Posts

Ok since I searched for the last hours to find a definitive answer.

Is it possible to do a HotkeySet on a mousebutton? Preferable xButton1/xButton2

Also why isn't this just standard included in the hotkeyset as {xButton1} {xButton2} and would that be hard to include it?

If there is no standard solution is there maybe a UDF which can do this? or maybe a dll call in a hotkeyset?

Hope someone have some answers for me :)

with regards,

Hawkysoft

Link to comment
Share on other sites

Hi Hawkysoft,

  I assume you are referring to the additional function buttons on your mouse?

I am not sure how you would use a HKS directly for this but you can set up your Mouse Buttons to Emulate say the F2 Key and tie the HKS to that key.

Bill

Edited by billo
Link to comment
Share on other sites

Hi Hawkysoft,

  I assume you are referring to the additional function buttons on your mouse?

I am not sure how you would use a HKS directly for this but you can set up your Mouse Buttons to Emulate say the F2 Key and tie the HKS to that key.

Bill

Hey billo,

Thanks for your answer, that's basically my backup plan ;)

People adviced me not to use the _ispressed method, since that would be slower in performance. That's basically why I'm looking for a original/better function

Just hope the dev's from autoit will implement it in HotKeySet ;/

Link to comment
Share on other sites

Mouse buttons aren't keys, so you can't set them like keys, _IsPressed is what you need regardless of performance. Unless you want to start dealing with Windows messages (GUIRegisterMsg for a hint).

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Mouse buttons aren't keys, so you can't set them like keys, _IsPressed is what you need regardless of performance. Unless you want to start dealing with Windows messages (GUIRegisterMsg for a hint).

Τhey actually are keys and you can set them as keys. You can register it's hex same as another key and then use hotkeyset function.

It will work with the actual key and the set mouse key.

Link to comment
Share on other sites

Τhey actually are keys and you can set them as keys. You can register it's hex same as another key and then use hotkeyset function.

It will work with the actual key and the set mouse key.

than what is wrong with this?

HotKeySet("05", "Test")

While 1
    Sleep(100)
WEnd
;;;;;;;;

Func Test()
    MsgBox(4096, "", "This is a message.")
EndFunc

tried "0x05" as well

Edited by Hawkysoft
Link to comment
Share on other sites

HotKeySet(0x05, "Test")

While 1
Sleep(100)
WEnd
;;;;;;;;

Func Test()
MsgBox(4096, "", "This is a message.")
EndFunc

Tried this at work, but seems to be not working either, it pops up on the number key, do i need to registrate the hex key first on a different way?

Will test this also when im at home since thats a more reliable AI version

Edited by Hawkysoft
Link to comment
Share on other sites

What hotkeys do is set different keystrokes on different buttons of your keyboard. Which means you can press keystroke 9 and work as keystroke 5

Try registering you mouse keystroke to an other one of the keyboard and then use HotKeySet to that button.

You can even do it with your mouse button i think but i am not sure. I haven't test it yet.

Link to comment
Share on other sites

Searching the forum I found >this.

And >this (works on MouseWheel)

Or even better: >This

What did you find when you searched the forum?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

How about the threads I suggested?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Τhey actually are keys and you can set them as keys. You can register it's hex same as another key and then use hotkeyset function.

It will work with the actual key and the set mouse key.

You'd actually be wrong about that, your script doesn't work with the mouse, it only works when you press the number 5 key.

HotKeySet(0x05, "Test")

While 1
Sleep(100)
WEnd
;;;;;;;;

Func Test()
MsgBox(4096, "", "This is a message.")
EndFunc

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

You'd actually be wrong about that, your script doesn't work with the mouse, it only works when you press the number 5 key.

My script isn't what i wrote. It is an example. Registering the mouse button isn't in that small piece of code. I just copied the OP's example and removed the quotes on the HotKeySet function arround the hex. If you read carefully what i am saying then you may understand what i mean ;)
Link to comment
Share on other sites

How about the threads I suggested?

Hey, sorry for the late reply

Well the hook.dll seems to be interesting however I cant find the exact hex code for the xbutton1 and xbutton2 like they done in the source script

the.

the mousewheel i've tried but didn't get it to work either with xbutton1/2

and the mouseonevent is more the thing that i try to avoid having a switch with cases (else would have used ispressed ;))

 

My script isn't what i wrote. It is an example. Registering the mouse button isn't in that small piece of code. I just copied the OP's example and removed the quotes on the HotKeySet function arround the hex. If you read carefully what i am saying then you may understand what i mean ;)

Than how to register the xbutton1/2 on the right method? I thought you had it working like this?

Edited by Hawkysoft
Link to comment
Share on other sites

My script isn't what i wrote. It is an example. Registering the mouse button isn't in that small piece of code. I just copied the OP's example and removed the quotes on the HotKeySet function arround the hex. If you read carefully what i am saying then you may understand what i mean ;)

You posted it, so I assumed you'd tested it. Your script doesn't work as written, so why did you post it? I read what you wrote in this thread, and you've never explained EXACTLY how you're supposed to use HotKeySet with a mouse button. Frankly, I'm at a loss as to what it is you're saying as to how to do it, because you've given no information that's relevant.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I know some things are difficult for some people to understand but as an mvp you should know that you can set your mouse buttons however you want via the mouse settings without even having to use autoit for that part.

Then you can use hotkeyset function to the key you set your mouse. For example if you set your mouse button as keystroke 5 then hotkeyset with keystroke 5 would work. This is the easy way.

Having a mouse with more than left, right and mouse wheel buttons means that you have probably a driver installed for the mouse with the setting running on the background. Chek them out.

Link to comment
Share on other sites

I know some things are difficult for some people to understand but as an mvp you should know that you can set your mouse buttons however you want via the mouse settings without even having to use autoit for that part.

Then you can use hotkeyset function to the key you set your mouse. For example if you set your mouse button as keystroke 5 then hotkeyset with keystroke 5 would work. This is the easy way.

Having a mouse with more than left, right and mouse wheel buttons means that you have probably a driver installed for the mouse with the setting running on the background. Chek them out.

 

Thanks for your answer, but if I wanted to remap the mousekeys I wouldnt have to use the hex keys at all... but the point is I dont want to remap em every time..

So if anyone knows how to get this done without remapping of buttons on the mouse nor having ispressed methodes please let me know.

Also if theres a dll out there to do this for xbutton1/2 im happy to hear about that as well :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...