It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming ASP & ASP.NET Forum

VB 2010 Automation Issue

VB 2010 Automation Issue

Postby Apox on Wed Sep 14, 2011 2:01 pm

Hello All,

So this is my first time posting ever on a forum, normally I believe that if you are having a problem then 10 other people are also having the same isse and of that 10, 2 have posed a solution for it. However, this seems to not be the case. I am creating a VB 2010 program that lets your select the program(s) you want to install (chkbox) and hit run. Then have it launch the installer ( the file is across the server) and accept the predefined keystrokes to proceed through the installation process. Afterwards, it starts the next install. Below is the code that I have. What i cant get to function is the unit accepting the keystrokes, its almost as if it wont take focus ( even when i have used Appactivate and threading.thread.sleep). I have even gone so far as to identify it as a process to manipulate the thread. To be honest, i'm at a loss and need any help at all. The final sub that contains "btntest" is where I am at currently in my attempts.




Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click




If chkmapPoint.Checked Then

System.Diagnostics.Process.Start("\\amcfs1\work programs\A Software License Required\MapPoint\MapPoint2010\setup.exe")
Threading.Thread.Sleep(300)
SendKeys.SendWait("~")
SendKeys.SendWait("~")

End If

If chkeFax.Checked Then
System.Diagnostics.Process.Start("\\amcfs1\work programs\#1alllaptops\eFAX\efaxmessenger64bit.exe")
End If

If chkPrinter.Checked Then
System.Diagnostics.Process.Start("\\amcfs1\work programs\#1alllaptops\HP_PrinterRefresh_Barringer.bat")
End If

If chkGobi.Checked Then
System.Diagnostics.Process.Start("\\amcfs1\drivers\6420\Gobi\Driver\setup.exe")
End If

If chkOutlook.Checked Then
System.Diagnostics.Process.Start("C:\Program Files (x86)\Microsoft Office\Office14\outlook.exe")
End If

If chkPGP.Checked Then
System.Diagnostics.Process.Start("\\amcfs1\work programs\PGPDesktop64_en-US_auto_detect.msi")
End If

End Sub

Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click

Dim p As New Process
p.StartInfo.FileName = "\\amcfs1\work programs\A Software License Required\MapPoint\MapPoint2010\setup.exe"
p.Start()
p.WaitForInputIdle(10000)

Dim windowHandle As IntPtr
windowHandle = IntPtr.Zero
'MessageBox.Show(Process.GetProcessById(p.Id).MainWindowTitle)
'Console.Write(Process.GetProcessById(p.Id).MainWindowHandle)
windowHandle = Process.GetProcessById(p.Id).MainWindowHandle


SendKeys.SendWait("{ENTER}")
'SendKeys.SendWait("%N")
'SendKeys.SendWait("{ENTER}")





End Sub
End Class
Apox
 
Posts: 1
Joined: Wed Sep 14, 2011 1:58 pm

Who is online

Users browsing this forum: No registered users and 1 guest