PDA

View Full Version : SendKeys chars are lost inexplicably (W2K)



gardinerdm
06-06-2002, 08:33 PM
Hello,

I'm trying to use SendKeys in an effort to send "Alt-T S A" to my exchange client (Synchronize All Folders). It works 90% of the time... but about 10% of the time it drops the S and the A... It always drops the S and A on the first script run after a new logon... successive script runs work fine. Is there a better way to get this done?

Best Rgds, Dan

Gwap = WshShell.Popup("Synchronizing All Folders", 5, "Please Wait!", 4161)

If Gwap = -1 Then
WshShell.AppActivate "Exchange"
WScript.Sleep 500 'sleep for .5 seconds
WshShell.SendKeys "%(t)sa"

ElseIf Gwap = 1 Then
WshShell.AppActivate "Exchange"
WScript.Sleep 500 'sleep for .5 seconds
WshShell.SendKeys "%(t)sa"

ElseIf Gwap = 2 Then
kill = WshShell.Run("kill -f exchng32", 7, True)
End If

ywhw
06-26-2002, 02:43 AM
what is probably happening is the system is not responding as quickly as you would like. Instead of doing all the commands at once try a sleep between...


WshShell.SendKeys "%(t)"
wscript.sleep 100
WshShell.Sendkeys "s"
wscript.sleep 100
WshShell.Sendkeys "a"