Jump to content

_ispressed mousewheel


Vivvic
 Share

Recommended Posts

I want my mousewheel left to press "A" twice.

#include<c:/program files/autoit3/beta/include/misc.au3>
while 1
    if _IsPressed("91") And _IsPressed("25") Then
        MsgBox( 0, "test", "test")
        ;testing ;Send( "aa" )
    EndIf
Sleep(10)
WEnd

;Autot recorder returned this
;it is what happens after I press my mousewheel to the left
;Send("{SCROLLLOCK}{RIGHT}{SCROLLLOCK}#endregion --- ScriptWriter generated code End --- 
;I want to make it press "a" two times if I press the mousewheel to the left

Help appreciated

Thanks in advance

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

  • Moderators

Mine doesn't generate that, so I have no way of testing, but I would assume it would be something really drawn out like:

While 1
    If _IsPressed('91') Then
        While _IsPressed('91')
            Sleep(10)
        WEnd
        If _IsPressed('27') Then
            While _IsPressed('27')
                Sleep(10)
            WEnd
            If _IsPressed('91') Then
                While _IsPressed('91')
                    Sleep(10)
                WEnd
                If _IsPressed('27') Then
                    While _IsPressed('27')
                        Sleep(10)
                    WEnd
                    If _IsPressed('91') Then
                        While _IsPressed('91')
                            Sleep(10)
                        WEnd
                        Send('aa')
                    EndIf
                EndIf
            EndIf
        EndIf
    EndIf
    Sleep(10)
WEnd

Func _IsPressed($v_R, $v_dll = 'user32.dll')
    $v_R = DllCall($v_dll, 'int', 'GetAsyncKeyState', 'int', '0x' & $v_R)
    Return (Not @error And BitAND($v_R[0], 0x8000) = 0x8000) * 1
EndFunc   ;==>_IsPressed

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

-thanks for fast reply.-

Hmm, still dosnt seem to be working, perhaps my hex for the keys are incorrect, I rember someone (on I think a german keyboard?) wanting to know what the hex for the key to the left of one(1) on his keyboard was and a script was given to him, could someone point me in the direction of this script?

EDIT: Would that work for a mouse buttion as well? It should shouldnt it?

Edited by Vivvic

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

Ok, got it working but it isnt reliable and is taxing on cpu when I run it during unreal tournment (reason for makeing) any way to inprove?

#include<c:/program files/autoit3/beta/include/misc.au3>
while 1
    if _IsPressed("25") = 1 Then
        Send( "aa" )
    EndIf
WEnd

EDIT:TYPO

Edited by Vivvic

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

Ok, got it working but it isnt reliable and is taxing on cpu when I run it during unreal tournment (reason for makeing) any way to inprove?

#include<c:/program files/autoit3/beta/include/misc.au3>
while 1
    if _IsPressed("25") = 1 Then
        Send( "aa" )
    EndIf
WEndoÝ÷ Ø@ÈM6;ú®¢×¯&®¶­s`§vÆR¢6ÆVW#S bô5&W76VBgV÷C³#RgV÷C²ÒFVà 6VæBgV÷C¶gV÷C² VæD`¥tVæ@

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Yes, I origonaly had a sleep in it but it isnt responsive.....is there a way I can add a sleep while keeping it as responsive as possible?

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

  • Moderators

While 1
    Sleep (10)
    If _IsPressed("25") Then
        Send( "aa" )
        Sleep(250)
    EndIf
WEnd

Edited by SmOke_N

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

Thanks, that seems to work alot better.

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

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