Results 1 to 6 of 6

Thread: [2005] Quick Question

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2006
    Posts
    63

    [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.

  2. #2
    Fanatic Member BillBoeBaggins's Avatar
    Join Date
    Jan 2003
    Location
    in your database, dropping your tables.
    Posts
    628

    Re: [2005] Quick Question

    Do you want to open a file with text, or enter it in programmatically?

  3. #3
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2005] Quick Question

    Maybe something like this:

    VB Code:
    1. Dim p As System.Diagnostics.Process
    2.         p = System.Diagnostics.Process.Start("C:\WINDOWS\Notepad.exe")
    3.         p.WaitForInputIdle()
    4.         AppActivate(p.Id)
    5.  
    6.         SendKeys.Send("Hello")

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2006
    Posts
    63

    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

  5. #5
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    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.

  6. #6

    Thread Starter
    Member
    Join Date
    Oct 2006
    Posts
    63

    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
  •  



Click Here to Expand Forum to Full Width