Ciao a tutti, sto facendo un programma in vb.net che ne apre un altro. Il mio problema è che quando premo il bottone avvia sul mio programma (questo bottone deve aprire un altro programma e fare il login) mi apre corretteamente il programma ma non fa correttamente il login, o meglio lo fa abbastanza raramente. Penso che ciò che lo fa fallire il più delle volte sia l'immagine che compare subito dopo aver aperto il programma esterno, perchè essa rimane in primo piano per qualche secondo, ma non sempre per lo stesso tempo. Ora vi posto il codice della sequenza di tasti che gli invio:
Public Function EntraInAR()
Dim pathEn As String = "C:\Program Files\AR System\aruser.exe"
Dim pathIt As String = "C:\Programmi\AR System\aruser.exe"
If File.Exists(pathEn) Then
Process.Start(pathEn)
ElseIf File.Exists(pathIt) Then
Process.Start(pathIt)
Else
MsgBox("Programma non trovato")
End If
Thread.Sleep(3500) 'tempo in millisecondi
SendKeys.Send(UtenteAR)
Thread.Sleep(1500)
SendKeys.Send("{TAB}")
SendKeys.Send(PwdAR)
Thread.Sleep(1000)
SendKeys.Send("{TAB}")
SendKeys.Send("tssc.rm.tim.it")
SendKeys.Send("{TAB}")
SendKeys.Send("6500")
SendKeys.Send("{TAB}")
SendKeys.Send("{TAB}")
SendKeys.Send("{ENTER}")
Return 0
End Function