It is currently Sat Jan 18, 2020 6:16 pm



Reply to topic  [ 3 posts ] 
 Mouse is on Position and give a Key 
Author Message
One Eyed Hopeful

Joined: Fri Dec 20, 2019 2:27 am
Posts: 3
Reply with quote
Hi all

my other try,
Mouse is on Position give a Number Pad 5

Mouse is in Position 920 < x < 960 and 520 < y < 560 work fine
but it give no Key.NumberPad5 out
how i can do this?

Code:
class POINT(Structure):
    _fields_ = [("x", c_long), ("y", c_long)]

def queryMousePosition():
    pt = POINT()
    windll.user32.GetCursorPos(byref(pt))
    return { "x": pt.x, "y": pt.y}

pos = queryMousePosition()
x = pos["x"]
y = pos["y"]
diagnostics.watch("x:" + str(x) + ", y:" + str(y))



if  920 < x < 960 and 520 < y < 560:

   windll.user32.keyboard.setKey(Key.NumberPad5)


Sat Dec 21, 2019 7:24 am
Profile
One Eyed Hopeful

Joined: Fri Dec 20, 2019 2:27 am
Posts: 3
Reply with quote
ok i find it :)

Code:
class POINT(Structure):
    _fields_ = [("x", c_long), ("y", c_long)]

def queryMousePosition():
    pt = POINT()
    windll.user32.GetCursorPos(byref(pt))
    return { "x": pt.x, "y": pt.y}

pos = queryMousePosition()
x = pos["x"]
y = pos["y"]
diagnostics.watch("x:" + str(x) + ", y:" + str(y))



if  900 < x < 980 and 500 < y < 580:
   if inside == False:
      inside = True
      keyboard.setPressed(Key.NumberPad5)
else:
   inside = False


Sat Dec 21, 2019 7:36 am
Profile
One Eyed Hopeful

Joined: Thu Oct 19, 2017 6:14 pm
Posts: 21
Reply with quote
Can I get that full script, I've been trying to figure something like this out for a long time


Thu Jan 02, 2020 12:55 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by STSoftware.