473,382 Members | 1,107 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Emulating keyboard strokes in vb.net

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!

Jun 13 '06 #1
3 5628
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" <Su*******@gmail.com> schreef in bericht
news:11**********************@h76g2000cwa.googlegr oups.com...
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!

Jun 13 '06 #2
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" <Su*******@gmail.com> schreef in bericht
news:11**********************@h76g2000cwa.googlegr oups.com...
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!


Jun 13 '06 #3
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" <Su*******@gmail.com> schreef in bericht
news:11**********************@c74g2000cwc.googlegr oups.com...
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" <Su*******@gmail.com> schreef in bericht
news:11**********************@h76g2000cwa.googlegr oups.com...
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!

Jun 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: magician | last post by:
hi can any one suggest a way to utilize the keyboard to control an animation for example in a space invaders game. when a key is pressed and hed at the moment, there is one movement and then a...
4
by: Ralf Toender | last post by:
Hi! Does anybody know how to send a keystroke C#? In C++ it's done by: keybd_event ( ... ) or SendInput ( ... ). What namespace does include this counterpart? Thanks Ralf
6
by: Al Bahr | last post by:
H I need to combine Ink strokes with the background image into a bit map. Would appreciate any help Thank A
0
by: CForrester | last post by:
Hey there, I'm trying to emulate a joystick throttle using keyboard keys. For example: ` = 0%, 1 = 10%, 2 = 20%, 3 = 30%, 4 = 40%, 5 = 50%, 6 = 60%, 7 = 70%, 8 = 80%, 9 = 90%, 0 = 100% My...
1
by: Jacek Jurkowski | last post by:
If You enter "osk" into a commad box of Your windows You will bring On screen keyboard. I must wrote my own version and I'm asking about some how to... How to send a key strokes not to active...
1
by: zanthor | last post by:
Ok... so call me crazy, but I have an idea and I'm looking for where to start... I want to write an application that catches keystrokes and then either redirects them to the in focus window or...
5
by: mattmao | last post by:
Hello everyone, I am studying the programming language C from the scratches, so my question might be too simple for you guys: How would you clear your previous keyboard strokes while let the...
11
by: vbguy2008 | last post by:
Hi, I am coding a Windows Form Application in VB.NET 2008. I would like to clear the keyboard buffer or at least empty all outstanding key presses queued up for my application at certain points...
8
by: Ron Eggler | last post by:
Hi, I would like to get the time of the most recent human activity like a cursor movement or a key hit. Does anyone know how I can get this back to start some action after there has been no...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.