Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mouse Autopilot
#1
Hello,

Sorry, I speak a little English.

I would like a little python script.

I am use Debian Jessie linux, but I would like use my script is Windows.

I would like left button down in my mouse, continuously clicking simulation. If I up the mouse button, then stop clicking simulation.

I need exe file, no py file because the Windows is not installed the Python.

Do you know help me?

I am beginner in Python. I would like learning, but the program is need fast. Do you know help me?

I'm sorry, my English-know is very poorly.

Thanks at all.
Reply
#2
So you don't want anything to happen if you're not touching the mouse?
You're trying to continuously send "MouseClick" events as long as you have the mouse clicked?

What have you tried so far?
Reply
#3
(Nov-14-2016, 08:27 PM)nilamo Wrote: So you don't want anything to happen if you're not touching the mouse?
You're trying to continuously send "MouseClick" events as long as you have the mouse clicked?

What have you tried so far?

Wow! Your answer is very fast. I don't know this forum, but I'm very happy.

I never tried anything because my English language is very bad and I am very-very beginner in Python.

The script:

left mouse down
click
click
click
click
left mouse up

I would like programming this linux, but if the script is finish, convert to exe file and run this script in Windows.

If I know English, I don't have a question, I learn manuals and other websites. Please help me. Pray
Reply
#4
If you just wanted this to work with windows, I'd suggest using win32api or ctypes (examples here: http://stackoverflow.com/a/1181539).  But to be cross platform, the easiest way will be to use a package such as this one: https://github.com/PyUserInput/PyUserInput

Here's a link to one of PyUserInput's tests, it looks like it should easily be modified to do exactly what you're after:
https://github.com/PyUserInput/PyUserInp...sic.py#L21 Wrote:
try:
    from pymouse import PyMouseEvent

    class event(PyMouseEvent):
        def move(self, x, y):
            print("Mouse moved to", x, y)

        def click(self, x, y, button, press):
            if press:
                print("Mouse pressed at", x, y, "with button", button)
            else:
                print("Mouse released at", x, y, "with button", button)

    e = event()
    #e.capture = True
    e.start()

except ImportError:
    print("Mouse events are not yet supported on your platform")
Reply
#5
(Nov-14-2016, 08:47 PM)nilamo Wrote: If you just wanted this to work with windows, I'd suggest using win32api or ctypes (examples here: http://stackoverflow.com/a/1181539).  But to be cross platform, the easiest way will be to use a package such as this one: https://github.com/PyUserInput/PyUserInput

Here's a link to one of PyUserInput's tests, it looks like it should easily be modified to do exactly what you're after:
https://github.com/PyUserInput/PyUserInp...sic.py#L21 Wrote:
try:
    from pymouse import PyMouseEvent

    class event(PyMouseEvent):
        def move(self, x, y):
            print("Mouse moved to", x, y)

        def click(self, x, y, button, press):
            if press:
                print("Mouse pressed at", x, y, "with button", button)
            else:
                print("Mouse released at", x, y, "with button", button)

    e = event()
    #e.capture = True
    e.start()

except ImportError:
    print("Mouse events are not yet supported on your platform")

I download the https://codeload.github.com/PyUserInput/...zip/master and unzip.

I try:

cd /home/jakabgipsz/Downloads/PyUserInput-master
sudo python setup.py install


I try:

python nilamo.py

Write the console: Mouse events are not yet supported on your platform

Think
Reply
#6
The normal way to install things in python would be to use pip. So here, it would have been "pip install PyUserInput". It's sort of our version of apt-get and similar package managers. I believe the reason you got that error is because Xlib isn't installed (pip would have installed dependencies for you). Here's a link to xlib: https://github.com/python-xlib/python-xlib

If you change the script you're testing with and comment out the try and except lines, you'll see the actual error message, which might confirm my suspicions.
Reply
#7
(Nov-14-2016, 09:08 PM)nilamo Wrote: The normal way to install things in python would be to use pip.  So here, it would have been "pip install PyUserInput".  It's sort of our version of apt-get and similar package managers.  I believe the reason you got that error is because Xlib isn't installed (pip would have installed dependencies for you).  Here's a link to xlib: https://github.com/python-xlib/python-xlib

If you change the script you're testing with and comment out the try and except lines, you'll see the actual error message, which might confirm my suspicions.

I have download Xlib and python setup.py install and python get-pip.py, and my script is run, but not working and not write error message. Think
Reply
#8
If there's no error, how do you know it's not working?
Reply
#9
(Nov-14-2016, 09:41 PM)nilamo Wrote: If there's no error, how do you know it's not working?

jakabgipsz@debian:~$ python nilamo.py (instantly next)
jakabgipsz@debian:~$

I would like run the script, waiting for my left mouse down.

run
waiting left mouse down
left mouse down
click
click
click
click
left mouse up
waiting left mouse down
left mouse down
click
click
left mouse up

exit if i close this script
Reply
#10
What's the script you're running?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Sending Emails on Autopilot Gyga_Hawk 3 1,692 Mar-15-2022, 08:20 AM
Last Post: Larz60+
  mouse 0.7.0 - mouse polling hate 125-1000hz penahuse 1 2,535 Dec-06-2019, 09:51 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020