Jump to content

Disable mouse wheel down except for Ventrilo


Recommended Posts

I am trying to make a script that disables the mouse-scroll-down-button except for Ventrilo. This is what I came up with and it doesn't work. In vent I have "F" bound to the push-to-talk hotkey. Right now all it does is send "F" over and over again very quickly and vent doesn't recognize it.

Instead of disabling the mouse-scroll-down-button only for Ventrilo could we disable disable it for application/window X? Like if the window is Mozzilla Firefox and you click the mouse-scroll-down-button nothing will happen in that window but Vent will still be able to pick up the push-to-talk hotkey when it's bound to the mouse-scroll-down-button

#include <MouseSetOnEvent_UDF.au3>

_MouseSetOnEvent($MOUSE_WHELLDOWN_EVENT, "ExtraButtonDown_Event")
_MouseSetOnEvent($MOUSE_WHELLUP_EVENT, "ExtraButtonUp_Event")

$go = 0
While 1
    If $go = 1 Then
        ;AutoItSetOption ("SendKeyDownDelay", 1000)
        ControlSend("Ventrilo", "", "", "{F}")
    EndIf
WEnd

Func ExtraButtonDown_Event()
    $go = 1
EndFunc

Func ExtraButtonUp_Event()
    $go = 0
EndFunc

Exit
Func _IsPressed($hexKey)
  Local $aR, $bO
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
  If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
     $bO = 1
  Else
     $bO = 0
  EndIf
  Return $bO
EndFunc
Link to comment
Share on other sites

You won't be able to disallow other applications to "sniff" mouse input, but you could modify your script so that when a WheelDown event occurs it immediately performs a WheelUp event and does the ControlSend to Vent. The wheel would only be performing an action in applications such as Firefox for a few milliseconds.

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

I meant not scroll down but when you push the "scroll" button down... =P

like on some mice you can push it down without actually rolling it forwards or backwards and it counts as a button on the mouse. Like if yo do it in a browser the little scroll image pops up (the one image that has a little arrow going up and an arrow going down and scrolls the page)

Link to comment
Share on other sites

I meant not scroll down but when you push the "scroll" button down... =P

like on some mice you can push it down without actually rolling it forwards or backwards and it counts as a button on the mouse. Like if yo do it in a browser the little scroll image pops up (the one image that has a little arrow going up and an arrow going down and scrolls the page)

You can still force the button back up upon a down press with the MouseClick function. It allows you to press secondary buttons, not just left and right.
Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

OK, that sounds like a reasonable solution, but how can I send mouse buttons? Something like Send("{MOUSE_WHEEL_UP}") I'd imagine...

thanks for all of your help this far =D

Link to comment
Share on other sites

OK, that sounds like a reasonable solution, but how can I send mouse buttons? Something like Send("{MOUSE_WHEEL_UP}") I'd imagine...

thanks for all of your help this far =D

You don't send mouse clicks. Read up on the MouseClick() function in the help file. It explains how to click the buttons.
Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

OK, but when I do MouseClick("middle") it only sends F to ventrilo once...

Is there any way I can say ControlSend("Untitled", "", "", "{F}") UNTIL $go = 0

??

...you know because right now I'm just using that while loop

Edited by Leoj
Link to comment
Share on other sites

OK, but when I do MouseClick("middle") it only sends F to ventrilo once...

Is there any way I can say ControlSend("Untitled", "", "", "{F}") UNTIL $go = 0

??

...you know because right now I'm just using that while loop

What do you have so far? Judging from the last code you posted, the loop is already going to continue pressing F as long as $go = 1.
Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

#include <MouseSetOnEvent_UDF.au3>

_MouseSetOnEvent($MOUSE_WHELLDOWN_EVENT, "ExtraButtonDown_Event")
_MouseSetOnEvent($MOUSE_WHELLUP_EVENT, "ExtraButtonUp_Event")
$downOnce = 0
$upOnce = 0
$go = 0
While 1
    If $go = 1 Then
        MouseClick("middle")
        ;Send("w")
        ;AutoItSetOption("SendKeyDownDelay", 1000)
        ;ControlSend("Untitled", "", "", "{F}")
        Run("sendFtoVent.exe")
    EndIf
    Sleep(10)
WEnd

Func ExtraButtonDown_Event()
    If $downOnce = 0 Then
        $go = 1
    EndIf
    $downOnce = 1
EndFunc

Func ExtraButtonUp_Event()
    $go = 0
    If $upOnce = 1 Then
        ;MsgBox(0,"up","mid mouse up")
        ProcessClose("sendFtoVent.exe")
        $upOnce = 0
    EndIf
    $upOnce = 1
    $downOnce = 0
EndFunc

Exit
Func _IsPressed($hexKey)
  Local $aR, $bO
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
  If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
     $bO = 1
  Else
     $bO = 0
  EndIf
  Return $bO
EndFunc

sendFtoVent.exe:

$sent = 0
While 1
    If $sent = 0 Then
        AutoItSetOption("SendKeyDownDelay", 100000)
        ControlSend("Untitled", "", "", "{F}")
    EndIf
    $sent = 1
    Sleep(10)
WEnd

Oh and "Untitled" is because I'm just sending it to notepad for now for testing

Edited by Leoj
Link to comment
Share on other sites

Wowww I just discovered: {f down}... Ill let you know how that works out :)...

EDIT: Wait, I'm a tard... I can't ControlSend {f down} can I???

Edited by Leoj
Link to comment
Share on other sites

Wowww I just discovered: {f down}... Ill let you know how that works out :)...

EDIT: Wait, I'm a tard... I can't ControlSend {f down} can I???

Yes, you should be able to do it.
Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

Thanks TONS and TONS wolf, you ROCK my socks off.

(following code for reference, pretend it's not even in this post =P)

#include <MouseSetOnEvent_UDF.au3>

$mButDwn = $MOUSE_EXTRABUTTONDOWN_EVENT
$mButUp = $MOUSE_EXTRABUTTONUP_EVENT

_MouseSetOnEvent($mButDwn, "ExtraButtonDown_Event")
_MouseSetOnEvent($mButUp, "ExtraButtonUp_Event")

While 1

    Sleep(10)
WEnd

Func ExtraButtonDown_Event()
        ;Send("{, down}")
        MouseDown("middle")
EndFunc

Func ExtraButtonUp_Event()
        ;Send("{, up}")
        MouseUp("middle")
EndFunc

Exit
Func _IsPressed($hexKey)
  Local $aR, $bO
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
  If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
     $bO = 1
  Else
     $bO = 0
  EndIf
  Return $bO
EndFunc
Link to comment
Share on other sites

Is there any way to MouseDown/Up the thumb-button on the mouse?? All I see is MouseDown/Up for left, right, and middle keys =/

According to the help file, you have the following button choices: "left", "right", "middle", "main", "menu", "primary", "secondary".
Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

  • Moderators

:) What the hell is the "thumb button"? :)

I'd suggest you finding that Thumb Button on MSDN and link it back if you really want help on it.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

The two side buttons are the Back and Forward buttons. These buttons enable you to navigate conveniently in programs that use the Back and Forward commands, such as a Web browser. For example, you can use the back and forward buttons to navigate to the previous or the next Web page in Microsoft Internet Explorer.

http://support.microsoft.com/kb/258822

This UDF uses "$MOUSE_EXTRABUTTONDOWN_EVENT" to interact with the thumb button... and calls the "thumb button" the "extra button"... I don't know what's the best terminology but is it a bit clearer now?? =/

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