Hello,

I have designed a script (in java) that allows me to input a command like "Move 325 642" and the mouse cursor will move to that x,y position. The way that the java program works is when it initializes it runs in a constant loop reading the input each time something is sent to it... Here is an example of how i run the script from the terminal:
Code:
Cody@Charmander:~/Workspace/Mouse/mouse/>java MouseMove
Move 500 500
Click Left 1 1
Move 400 400
Click Right 1 1
Move 250 50
Click Left 2 2
Exit
Cody@Charmander:~/Workspace/Mouse/mouse/>



Here is what happens:
I typed: "Move 500 500" then hit enter
The code: Moved the mouse to pos x,y. Then waited for more input

I typed: "Click Left 1 1" then hit enter
The code: Left Clicked at the current position once, with one ms of wait. Then waited for more input

I typed: "Move 400 400" then hit enter
The code: Moved the mouse to pos x,y. Then waited for more input

I typed: "Click Right 1 1" then hit enter
The code: Right Clicked at the current position once, with one ms of wait. Then waited for more input

I typed: "Move 500 500" then hit enter
The code: Moved the mouse to pos x,y. Then waited for more input

I typed: "Click Left 2 2" then hit enter
The code: Left Clicked at the current position twice (double click), with two ms of wait between each click. Then waited for more input

I typed: "Exit" then hit enter
The code: Quit the program


This is all done at the terminal though and i need to have it done through a python file. Iím aware that i will have to use os.popen but am unfamiliar with how it works.

As an example could someone show me how to do this all in one "main.py" file.

Code:
import os #I know this will be needed

class JavaClass():
            def start():
                        #Start the java program

            def move(x,y):
                        #move the mouse (Inputs "Move x y")

            def click(button, times, delay):
                        #click the mouse (Inputs "Click button times delay")

            def close():
                        #Sends "Exit" to the program, ending it safely

JavaFile = New JavaClass()

JavaFile.start()              #Will open up the java file, then waits for input
JavaFile.move(500,500)                       #Input the following (exact same as above)
JavaFile.click("Left", 1, 1)         #Input the following (exact same as above)
JavaFile.move(400,400)                       #Input the following (exact same as above)
JavaFile.click("Right", 1, 1)       #Input the following (exact same as above)
JavaFile.move(250,50)             #Input the following (exact same as above)
JavaFile.click("Left", 2, 2)         #Input the following (exact same as above)
JavaFile.close()             #Will send "Exit" to the program closing it


Thank you very much for any help you are able to give me
~Cody Woolaver