Jump to content
Sign in to follow this  
psgame_freak

How to get the last button pressed by user?

Recommended Posts

but where do you need my function for ??? i still don't get it

He wants to do what you did in your first post, without "HotKeySet" so he can push right arrow+a and have it both execute a function, and still register the keys

Share this post


Link to post
Share on other sites

then just put get key in a loop and put a switch behind it -.-

it aint that hard

EDIT:

want an example mate ??

Edited by zeroZshadow

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites

want an example mate ??

Yes Please!

Thank you

You know what they say about people that talk to themselves and answer themselves :whistle:

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.

Share this post


Link to post
Share on other sites

omg, i just started coding, couln't help it

freaky XD

#Include <Misc.au3>
$speed = 10
while 1 
    $pos = MouseGetPos()
    switch _GetKey()
        case 26
            MouseMove( $pos[0], $pos[1]-$speed,0)
        case 27
            MouseMove( $pos[0]+$speed, $pos[1],0)
        case 28
            MouseMove( $pos[0], $pos[1]+$speed,0)
        case 25
            MouseMove( $pos[0]-$speed, $pos[1],0)
        case 21
            $speed = $speed +1
        case 22
            $speed = $speed -1
            if $speed < 0 then $speed = 0
    EndSwitch
WEnd
    
Func _GetKey()
    for $i = 1 to 165
        if _IsPressed(Hex($i,2)) Then
            return  Hex($i,2)
        EndIf
    Next
EndFunc

moves the mouse with ur arrow, doesn't do diagonal tho.

speed up and down with page up and page down.

hope this is what u mean


*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites

You still don't get -.-. Thanks for the code but I can't use that.

Try this code

Global $Modifier = ""

HotKeySet("{RIGHT}", "SetRightModifier")
HotKeySet("{LEFT}", "SetLeftModifier")

While 1
sleep(1000)
WEnd

Func SetRightModifier()
    $Modifier = "right"
EndFunc


Func SetLeftModifier()
    $Modifier = "left"
EndFunc

Try that code. When you press right or left arrow keys the $Modifier is assigned the value of "left" or "right but the cursor does not move to the right or left. What I want is to also be able to the cursor left or right while being able to assign values to $Modifier.

Edited by psgame_freak

Share this post


Link to post
Share on other sites

Global $Modifier

HotKeySet("{RIGHT}", "SetRightModifier")
HotKeySet("{LEFT}", "SetLeftModifier")

While 1
sleep(1000)
WEnd

Func SetRightModifier()
    If $Modifier <> 'right' Then $Modifier = "right"
    Send('{RIGHT}')
EndFunc


Func SetLeftModifier()
    If $Modifier <> 'left' Then $Modifier = "left"
    Send('{LEFT}')
EndFunc


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.

Share this post


Link to post
Share on other sites

Global $Modifier

HotKeySet("{RIGHT}", "SetRightModifier")
HotKeySet("{LEFT}", "SetLeftModifier")

While 1
sleep(1000)
WEnd

Func SetRightModifier()
    If $Modifier <> 'right' Then $Modifier = "right"
    Send('{RIGHT}')
EndFunc
Func SetLeftModifier()
    If $Modifier <> 'left' Then $Modifier = "left"
    Send('{LEFT}')
EndFunc
Recursive error...

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...