0

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!

1 Answer 1

3

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.

2
  • 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! Apr 2, 2012 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, 2012 at 21:16

You must log in to answer this question.

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