Mouse is on Position and give a Key

Official forum for open source FreePIE discussion and development.
Post Reply
Veteran66
One Eyed Hopeful
Posts: 15
Joined: Fri Dec 20, 2019 2:27 am

Mouse is on Position and give a Key

Post by Veteran66 »

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: Select all

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)
Veteran66
One Eyed Hopeful
Posts: 15
Joined: Fri Dec 20, 2019 2:27 am

Re: Mouse is on Position and give a Key

Post by Veteran66 »

ok i find it :)

Code: Select all

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
Canescj
One Eyed Hopeful
Posts: 21
Joined: Thu Oct 19, 2017 6:14 pm

Re: Mouse is on Position and give a Key

Post by Canescj »

Can I get that full script, I've been trying to figure something like this out for a long time
Post Reply

Return to “FreePIE”