|
-
Nov 9th, 2006, 08:07 PM
#1
Thread Starter
Member
[2005] Quick Question
Hey i've got a quick question if someone can help.
I want to open a notepad.exe document and have text come up.
So far i've been able to open the notepad.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
System.Diagnostics.Process.Start("C:\WINDOWS\Notepad.exe")
SendKeys.Send("Hello")
SendKeys.SendWait("Hello")
End Sub
End Class
Can anyone help me put in a code that will bring up text in the notepad?
eg Notepad opens, then Hello comes up.
Thanks.
-
Nov 9th, 2006, 08:20 PM
#2
Fanatic Member
Re: [2005] Quick Question
Do you want to open a file with text, or enter it in programmatically?
-
Nov 9th, 2006, 08:20 PM
#3
Re: [2005] Quick Question
Maybe something like this:
VB Code:
Dim p As System.Diagnostics.Process
p = System.Diagnostics.Process.Start("C:\WINDOWS\Notepad.exe")
p.WaitForInputIdle()
AppActivate(p.Id)
SendKeys.Send("Hello")
-
Nov 9th, 2006, 09:52 PM
#4
Thread Starter
Member
Re: [2005] Quick Question
I want it to Open notepad.exe then enter text.
Thanks Negative0 it worked.
What does the line:
p.waitforInputIdle()
Appactiveate(p.id)
do or mean.
Is there a way to make it appear like 1 letter ever 1 second? so when notepad is open it slowly starts appearing.
thanks
-
Nov 9th, 2006, 09:57 PM
#5
Re: [2005] Quick Question
WaitForInputIdle: http://msdn2.microsoft.com/en-gb/lib...inputidle.aspx
AppActivate:
http://msdn2.microsoft.com/en-us/library/dyz95fhy.aspx
Yes, there is a way to make the letters appear one at a time, you can either sendkeys slowly (i.e. putting a sleep command between each letter) or you can use a timer and send a letter each time the timer fires.
-
Nov 9th, 2006, 09:58 PM
#6
Thread Starter
Member
Re: [2005] Quick Question
Thanks for the quick reply could you post the code with a timer added in if its not to much trouble.
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|