AW: WIN32: How to control another windows application (AppActivat e not found)
Stefan Migowsky
smigowsky at dspace.de
Fri Jun 29 03:25:33 EDT 2001
You probably have an old Version of the Windows Scripting host.
See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wsh/htm/wsV
ersion.asp
for the Version information. AppActivate was introduced in Version 2.0 of
the Windows Scripting
host but W98 was shipped with version 1.0.
Try to get a new one at http://msdn.microsoft.com/scripting/
Bye
Stefan
> -----Ursprüngliche Nachricht-----
> Von: cliechti at nospam.mails.ch [mailto:cliechti at nospam.mails.ch]
> Gesendet: Freitag, 29. Juni 2001 00:48
> An: python-list at python.org
> Betreff: Re: WIN32: How to control another windows application
> (AppActivate not found)
>
>
> ---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)
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list