Sign in to follow this  
Followers 0
DesireDenied

_IsPressed()

6 posts in this topic

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
MyExit()
    For $i = 4 To 0 Step -2
    MouseMove(500-(10 * $i), 800-(10 * $i),$i)
    MyExit()
    MouseMove(300+(10 / $i), 500+(10 / $i),$i+1)
    MyExit()
    Next
WEnd
DllClose($dll)

Func MyExit()
        If _IsPressed(01 & 01, $dll) Then
        MsgBox(0,"", "exit",0.25)
        Exit
    EndIf
EndFunc

01 Left mouse button

02 Right mouse button

A2 Left CONTROL key

A3 Right CONTROL key

my problem is that im not really sure why expression '01 & 01' gives me hex 0xA2 value in my code.

would you explain to me why it is like that?


Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Because '&' is a string operator and your numbers were converted to strings before combining them, not mathematically adding them.

:)

P.S. What did you really want out of that "01 & 01", anyway?

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

exactly nothing -.-

i was just wondering what can i get out of this.

but how i get hex value = 0xA2 out of two strings '01' anyway?


Share this post


Link to post
Share on other sites

Also, IsPressed() is an odd bird in that it want numeric input, but requires them in a string. Assuming you want left mouse button, the correct value is "01" (a string of the number), not 01 (not a literal number). That always struck me as sloppy, but people much smarter than me wrote it, and I reckon they had their reasons.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

:)

i meaned why expression:

$i = 01 & 01

gives me

$i = 11

while

decimal 11 = hex 0x0B

and _IsPressed() interprete it as 0xA2


Share this post


Link to post
Share on other sites

...and _IsPressed() interprete it as 0xA2

No, _IsPressed() interprets its input as a string representations of a hex number, in this case "11". Which, if you look it up under _IsPressed in the help file, is CTRL, as opposed to A2 ("Left CONTROL").

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  
Followers 0