Jump to content

Recommended Posts

Posted

I have looked at this every which way I can, and I have been unable to find what I may have done wrong here. Here is the code:

#RequireAdmin
Run("C:\Users\Funky Monkey\Desktop\test\program.exe");
WinWaitActive("program");
Sleep(2000);
Send("{ENTER}",1)

The windows gets brought to the front, then sits there. I need it to send "Enter" so it closes automatically and continue on with the rest of the code. It's a really simple command, but just will not work! I am using Win7 64 bit is that makes any difference.

I tried using runwait, shellexecute and winactivate. Does not seem to make a difference. Except that winactivate does not bring the window forward.

Any help is appreciated. Thanks.

Posted

Not sure what you mean? I can manually hit the enter key and it works fine. Autoit just won't send the keystroke? I am positive that I have gotten this to work at some point in the past. I can't find the old code though! Grrr... this is becoming frustrating.

As a side note. I just tried in my XP VM and it does not work there either. :D

Posted (edited)

Thanks, Sleepercell. Gave it a go:

#RequireAdmin
Run("C:UsersFunky MonkeyDesktoptestprogram.exe");
WinWaitActive("program");
Sleep(2000);
ControlSend("program","","[CLASS:Button; INSTANCE:3]","{ENTER}",1)

But still no love unfortunately.

Autoit definitely detects it, as winwaitactive brings the window to the foreground, whereas without it, it stays in the background.

Edited by triodz
Posted

Welp, I finally figured it out. Here's the end code:

#RequireAdmin
Run("C:UsersFunky MonkeyDesktoptestprogram.exe","",@SW_SHOWNORMAL)
sleep(100)
Send("{ENTER}")

Thanks to all who took the time to throw in their 2 cents, I really do appreciate it. Not sure why "SHOWNORMAL" would make it behave differently than WinWaitActive. Possibility that it is a macro whereas WinWaitActive is a command? Dunno.

I know this was a simple thing, but I have spent hours trying to figure it out! I feel like the brick wall and I are very close compadre's now.

At least someone with the same issue has an answer.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...