Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Sendkeys send before window open

$
0
0
Hi,

I am writing a program that uses putty to telnet to a printer so I can set the ip,subnet mask, default gateway.

The problem that I get is that when I use sendkeys to the putty window, It will send it before the window is open. Also It seems to send even if putty is open but sends the sendkeys to the window behind it. Ive tried thread.sleep, me.refresh, application.doevents,appactivate, waitforeinputidle, anything to the delay the send.

Thanks in advance




p = Process.Start(CurDir() + "\programs\putty.exe", "telnet://192.168.1.2")

            x = p.WaitForInputIdle(10000)
            If x = True Then



                AppActivate("putty")
                Me.Refresh()

                SendKeys.Send("192.168.1.2" + "~")

                AppActivate("putty")
                Me.Refresh()

                SendKeys.Send("subnet-mask 255.255.255.0" + "~")

                AppActivate("putty")
                Me.Refresh()

                SendKeys.Send"(192.168.1.1" + "~")
                
                AppActivate("putty")
                Me.Refresh()

                'SendKeys.Send("save" & "~")
                
                Me.Refresh()

           Else:
                    msgbox("error")
                


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>