Results 1 to 2 of 2

Thread: Sending key sequences to other pograms?

  1. #1

    Thread Starter
    Addicted Member Dim A's Avatar
    Join Date
    Jul 2000
    Posts
    201
    I'd like to send ctrl-A to another program that isn't currently active. Ideally I'd like to trigger mouse events, key sequences on the other program. Basically I'd like to write a Macro program to interface with an already written program.

    Anyone have any information on how to do this? I'm thinking I'd have to use the FindWindow API, but I'm lost after that...

    Thanks,
    Dim A

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    You can use AppActivate to active a program that is already running;

    eg

    Code:
    AppActive "Notepad",True
    If you catch an error from AppActivate it means the app is open, so you can then use Shell to open it, and then AppActivate it.

    Once it is active you can use SendKeys to send keystrokes to it;

    eg

    Code:
    Sendkeys "Hello",True    'sends Hello to the program
    Sendkeys "^A",True       'sends CTRL+A to the program
    See the SendKeys help for more info

    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

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