wsh and Python

D

David Josty

Hello

I have this function :
--------------------------------------------------------
import sys
import win32com.client
import win32api

def close_softawre("name")
shell = win32com.client.Dispatch("WScript.Shell")
shell.AppActivate ("name")
win32api.Sleep(100)
shell.SendKeys ("%{F4}")
---------------------------------------------------------
But sometimes i have any problemes, the programme is not activate a time !!!


==> this is wsh !! i don't know translate in python

Do while WshShell.AppActivate ("name") = FALSE
wscript.sleep 100
loop

Thank a lot

a french guy
 
R

Roger Upole

Since AppActivate returns a boolean, you should be able
to do something like this:

while not shell.AppActivate(name):
win32api.Sleep(100)

Roger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top