WIN32: How to control another windows application (AppActivate not found)
chris liechti
cliechti at nospam.mails.ch
Thu Jun 28 19:47:55 EDT 2001
---snip--
> It's a very fragile approach (you're *WAY* better off using the
> Automation interface of the other application -- just about every
> application on Windows exposes some object model via Automation),
> but if you have some legacy app and absolutely must control it
> that way, see for example:
>
> http://aspn.activestate.com/ASPN/Python/Cookbook/Recipe/65107
---
i am interested in this too and i tried the recipe from the url above,
but...
the calculator shows up and then i get the folowing error:
---
Traceback (most recent call last):
File "sendkeys.py", line 6, in ?
shell.AppActivate("Calculator")
File "d:\python21\win32com\client\dynamic.py", line 437, in __getattr__
raise AttributeError, "%s.%s" % (self._username_, attr)
AttributeError: WScript.Shell.AppActivate
---
there is no 'AppActivate' nor a 'SendKeys' method available!
i'am using ActivePython 2.1 build 210 on Win98 any ideas what this could
be?
--- shortened piece of source - look at the link above for the full one!:
import win32api
import win32com.client
shell = win32com.client.Dispatch("WScript.Shell")
shell.Run("calc")
shell.AppActivate("Calculator")
shell.SendKeys("1{+}")
---
TIA
chris
--
import re
email = 'cliechti at nospam.mails.ch'
print re.sub('nospam\.','',email)
More information about the Python-list
mailing list