Re: [Tutor] Developing Macro: Is it possible in Python?

2008-08-03 Thread Emile van Sebille

Federo wrote:


Above actions can be easily performed using Macro Scheduler. I am looking for 
possibility to do the same with Python?


Hi Federo,

I regularly combine Macro Scheduler with python by having my python code 
write mSched scripts.  I find the combination of the two particularly 
adept at controlling legacy windows apps on current windows platforms.


The main function accepts a command list and name, writes a .scp msched 
script file and invokes the mSched command with os.system.


When I first considered how to approach this in about 2002, I looked at 
Mark Hammonds extensions and tried that, but it seemed to me at the time 
that the older apps simply didn't play nice and I fought harder to 
implement a pure python solution than the problem deserved.


Now, it's easy to review the python created msched scripts and 'follow 
along' to catch the odd bug.  mSched's capabilities have grown over that 
time as well and added some commands that make timing issues more 
predictable.  Although, I admit I'm never actually in the mSched 
environment so I may well be doing things with python that are entirely 
doable in mSched.  But, with python as glue I can control and coordinate 
as many disparate environments as the solution requires and it's mostly 
quick and easy.


Emile

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Developing Macro: Is it possible in Python?

2008-08-03 Thread Paul McGuire
I have used pywinauto for such tasks in the past.

http://pywinauto.openqa.org/
 
In my case, I used pywinauto to automate mouse clicks on a browser in order
to auto-play a Flash game running in the browser.  I had to use PIL to take
screenshots and then process images to "read" the screen.

-- Paul

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Developing Macro: Is it possible in Python?

2008-08-03 Thread Alan Gauld

"Federo" <[EMAIL PROTECTED]> wrote


Is it possible to do macro with Python?


Macro means different things in different context.


Macro should be able to click on given x,y screen
location (one click, double click), drag scroll bar up / down etc..


It seems that you are referring to simulating user actions.

The answer then is yes its possible but not trivial.
You can use the low level Windows API to send messages
to windows simulating mouse clicks etc. But it will usually require
monitoring the messages first using a program like Windows Spy.
The result is extremely fragile in that any change in the windows
environment can render your code useless.


Is there any other way beside macro to control windows
based application?


If it supports COM then you can use COM objects to
manipulate things directly. The winall package has support
for COM or you can use the API directly via ctypes.

I confess I tend to use VBScript for this kind of thing,
IMHO it plays with Windows much more simply than Python.

Alan G. 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Developing Macro: Is it possible in Python?

2008-08-02 Thread Federo
Hi

Is it possible to do macro with Python? Macro should be able to click on given 
x,y screen location (one click, double click), drag scroll bar up / down etc.. 
Macro should be also able to extract data from predefined screen x,y location. 
I would use this to control desktop windows based program. The program is 
written from external provider - not Microsoft or me (it runs on xp 
environment)..

Above actions can be easily performed using Macro Scheduler. I am looking for 
possibility to do the same with Python?

Is there any other way beside macro to control windows based application? The 
best will be to be able to control application from background (the same time 
mouse and screen would be free for other work. No flashing on screen. In ideal 
program would be ran as beck - hiden process..)

Cheers, Fedo


http://www.email.si/

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor