triodz Posted December 7, 2011 Posted December 7, 2011 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.
somdcomputerguy Posted December 7, 2011 Posted December 7, 2011 Could be the program doesn't accept external keystrokes.. or maybe something else.. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
triodz Posted December 7, 2011 Author Posted December 7, 2011 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.
OneManPen Posted December 7, 2011 Posted December 7, 2011 Ummmm... Instead of using just "send" try using control send to send it DIRECTLY to the program... or first check if autoit even detects it.
triodz Posted December 7, 2011 Author Posted December 7, 2011 (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 December 7, 2011 by triodz
triodz Posted December 7, 2011 Author Posted December 7, 2011 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now