Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a small application installed that runs on log in. Once I log in, I either have to click "Connect" or press "Enter" within the program for this program to start working. I'm looking for an automated way to press enter after the computer starts up.

I've contacted the developer to have an option to connect on the program launch, but this feature is several months away at best.

I appreciate any insight!

**Edit: It turns out this form does not have a default button setup. To get around this, I've attempted to tab to the correct control then press space.

WinWait, **The Window Title**
Send, {Tab}
Send, {Tab}
Send, {Tab}
Send, {Tab}
Send, {Space}

The problem is, I'm hitting a race condition. Sometimes the form hasn't been fully written to the screen yet, so the tab commands aren't getting to the right button on the form. Is there some way to wait a second for the form to finish loading, after the WinWait command to allow it to be written? One second would be more than enough.


share|improve this question
up vote 3 down vote accepted

AutoHotKey is great for little things like this. For what you want to accomplish, you'd need to launch this script on startup:

WinWait, **The Window Title**
Send, {Enter}

Just paste that into the AutoHotkey.ahk file that AutoHotKey creates when you install it and add AutoHotKey to your startup folder.

share|improve this answer
This is definitely the right direction. I'm encountering a race condition, which I've edited the question to represent. Thanks again for your help so far! – NickHeidke Apr 2 '12 at 19:41
If you just need it for a second, you can try sleep, not the most precise way, but might work for you: – MaQleod Apr 2 '12 at 21:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .