Have application press keys on the desktop?

Tex8503

Active Member
Licensed User
Longtime User
Hey folks,
I've got another small task I'm trying to do that doesn't seem like it should be difficult - but maybe I'm just missing something.

I've got a file with text - I'm reading it in and parsing it down to the letter. All I need to do is figure out a way to have the program 'press' each key that I'm feeding it into the active window. Please note this a desktop app.

My client has a PC app that we can only send keyboard data to... and while ugly - this is the best way I can think to do this.

Basically I'm looking for the equivalent of 'KeyPress' from the hardware library, but for the desktop. Could this maybe be accomplished with the Door library?

Any ideas?
 
Last edited:

Tex8503

Active Member
Licensed User
Longtime User
So I think I figured out the answer to my problem - but I'd like someone to confirm - because while it looks like its working, one can never be too sure

Credit goes to Erel for the code which I got from here: http://www.b4x.com/forum/questions-help-needed/3711-prevent-screen-saver.html

Using the door library as obj

obj.New1(False)
obj.CreateNew("System.Windows.Forms.SendKeys" & obj.System_Windows_Forms)
obj.RunMethod2("Send","{ENTER}","System.String")

Posting this in that it might help someone quicker than the hours worth of searching I did on the forum
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…