Jump to content

How to assign script to Mouse buttons


Recommended Posts

At first, hello everyone i'm new here ^^.

I've read the tutorial "Learning scripting Autoit v3", I know how to open Notepad, Calc.exe etc... But In that tutorial it doesn't mention about the assignment of script to a key or mouse button.

Ex: i would like create a script that press the button "5" and "6" on the keyboard whenever i click the middle button mouse. And if i click another button on keyboard the scirpt will be closed and another one button to re-activate the script How can i do that ?

And if i have a mouse that has more than 3 basics buttons (left, right, middle) how can i interact with the other buttons of my mouse ?

And is there a list of key words of the Autoit language ? Ex: how is right mouse button called int the scriptLite editor?

Thank you for reading my post.

Link to comment
Share on other sites

Welcome to the forum. Check-out Send(), MouseClick(), _IsPressed() functions in the help file.

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Link to comment
Share on other sites

Welcome to the forum. Check-out Send(), MouseClick(), _IsPressed() functions in the help file.

Thanks for your reply.

It works for the Middle button mouse, but when i assign it to the left button _isPressed("2"), it does send "5" and "6" but it show the menu when you right click mouse too, i would like that the left button acts simply as the press of key "5": and "6" not like a right mouse button. How can i do that ?

Link to comment
Share on other sites

You mean removing the context-menu on right mouse click? Sorry, I'll be unable to help with this.

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Link to comment
Share on other sites

Thank you very much Mkish, Who can i ask to resolve this problem ? Or what document should i read ? And please, one more question, i would like the left mouse acts like right mouse, and the right mouse acts as left mouse button ? Is that possible with autoit ?

Link to comment
Share on other sites

I have made a small script like that

#include 
Local $h = DllOpen("user32.dll")
Global $i = 1
Func TestClick()
   MsgBox (4096,"Test","Value of i = " & $i,10)
   While 1
   if _IsPressed("1", $h) Then
   Send ("{SHIFTDOWN}")
   Sleep("22")
   MouseClick("left")
   Sleep("22")
   Send("{ShIFTUP}")
   ElseIf _Ispressed("12",$h) Then
   $i=0
   ExitLoop
   EndIf
   WEnd
EndFunc
While 1
   if $i = 1 Then
   If _IsPressed("12",$h) Then
   TestClick()
   EndIf
   Else
   $i = 1
   EndIf
WEnd

I declare a function named Test Click it does Shift down -> click -> shift up. And i implemented a trigger where if i press alt button, it will enable or disable the script ( I'm using global value i to do that) but it didn't work, it does not deactivate the script and reactivate it like i want. Where is the error ?

Edited by rasx2610
Link to comment
Share on other sites

Read carefully in the help file. Use SHIFT UP instead of SHIFTUP and so on...

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

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...