This isn't an elegant way to do it, but it works for me. It runs a program, sends alt+h, a, tab, then ctrl+c to copy text to a clipboard and puts the contents of the clipboard into a textbox.
In sendkeys:
% = alt
vbTab = tab
^ = crl
{escape} = ESC
Imports System.Diagnostics.Process
Imports System.Threading
Public Class Form1
Public Sub GetSerials()
Dim pInfo As ProcessStartInfo = New ProcessStartInfo("C:\Program Files (x86)\CustomApp\Bin\customapp.exe")
pInfo.WindowStyle = ProcessWindowStyle.Maximized
Process.Start(pInfo)
Thread.Sleep(3000)
AppActivate("CustomApp 1.1.5")
System.Windows.Forms.SendKeys.SendWait("%")
System.Windows.Forms.SendKeys.SendWait("h")
System.Windows.Forms.SendKeys.SendWait("a")
System.Windows.Forms.SendKeys.SendWait(vbTab)
System.Windows.Forms.SendKeys.SendWait("^c")
TextBox2.Text = (TextBox1.Text & " : " & Clipboard.GetText & vbCr)
System.Windows.Forms.SendKeys.SendWait("{escape}")
System.Windows.Forms.SendKeys.SendWait("%")
System.Windows.Forms.SendKeys.SendWait("f")
System.Windows.Forms.SendKeys.SendWait("q")
End Sub
End Class
No comments:
Post a Comment