Re: Emulating keyboard strokes in vb.net



I'm sorry sendkeys indeed can't be used with a console app, I read your OP
to quick.
But can't you use Console.WriteLine("The matched part")
Something like this quick sample I made, it just keeps checking c:\test.txt
until it finds some text in it and the outputs it to the console if the text
is found

Sub Main()
Console.WriteLine("Hello I'm waiting for text in c:\test.txt")
Do While checkFile() = False
Threading.Thread.CurrentThread.Sleep(1000)
Loop
End Sub

Private Function checkFile() As Boolean
Dim strMessage As String
Dim myReader As New FileStream("c:\test.txt", FileMode.Open,
FileAccess.Read)
Dim myStreamReader As New StreamReader(myReader)
strMessage = myStreamReader.ReadToEnd()
myStreamReader.Close()
myReader.Close()
If strMessage = "" Then
Return False
Else
Console.WriteLine(strMessage)
Console.ReadLine()
Return True
End If


End Function


Hope this helps,

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Paulers" <SuperGh0d@xxxxxxxxx> schreef in bericht
news:1150226335.224424.229970@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks for the response but can I use those functions from a console
application? Or does it have to be a form applicaton?

Peter Proost wrote:
Have a look at:

SendKeys.Send
SendKeys.SendWait

They do what you want.

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to
produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Paulers" <SuperGh0d@xxxxxxxxx> schreef in bericht
news:1150171895.121750.311990@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

I need to emulate keyboard strokes from a console application. The
console application monitors a textfile and when something is matched
in a text file I need the matched string outputted to the keyboard as
if someone was typing on the keyboard. can someone help me locate the
correct vb.net function to use?

Thanks!




.



Relevant Pages

  • Re: Folder in which console application is launched
    ... bigger and better idiot-proof programs, and the Universe trying to produce ... bigger and better idiots. ... So far, the Universe is winning. ... > How can I find out from which folder my console application is launched? ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Emulating keyboard strokes in vb.net
    ... Peter Proost wrote: ... So far, the Universe is winning. ... I need to emulate keyboard strokes from a console application. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: keyboard failure that doesnt seem to be hardware
    ... Given the fact that I was able to type once I selected New login on the "locked screen" dialog and, at the splash for which user to log in as, the keyboard works, I figured the keyboard was not the problem. ... Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. ...
    (Fedora)
  • [2.6.11.7 / CLPS711x/SkyMinder] module integration issue: keyboard driver _still_ not working after
    ... a dummy/virtual serial console, ... confirmed as reasonably working, a framebuffer driver (which ... now i load the keyboard event module... ...
    (Linux-Kernel)
  • Re: Odd machine behaviour
    ... Windows) & the keyboard & mouse are completely unresponsive. ... and drops you to a console, in which case, you know it's still running ... I'd remove the KVM for testing purposes. ... So she actually has a keyboard & mouse attached & a minimal Gnome ...
    (Ubuntu)