Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

Thanks!

share|improve this question
add comment

1 Answer 1

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
1  
If you just need it for a second, you can try sleep, not the most precise way, but might work for you: autohotkey.com/docs/commands/Sleep.htm –  MaQleod Apr 2 '12 at 21:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.