Reputation: 279
I am running an "autoit3.chm" file. When it runs, I would like to send a down key arrow but it doesn't work:
$file = FileGetShortName("C:\Users\PHSD100-SIC\Desktop\AutoIt3.chm")
Run(@ComSpec & " /c start " & $file)
WinWaitActive("AutoIT Help")
Send("{DOWN}")
Upvotes: 2
Views: 5482
Reputation: 29
Use following syntax for down key enter
Send("{DOWN 2}")
and similar for Up key enter
Send("{UP 2}")
Upvotes: -1
Reputation: 5769
If you use the AutoIt Window Info tool, it helps with these issues, and it's also good practice to debug with ConsoleWrite(...)
s.
For example, a simple one would be as before. However, you should probably use timeouts or variables and use the return for success/fail.
WinWaitActive("Window")
ConsoleWrite("Success")
Send("{DOWN}")
ConsoleWrite("Success")
Upvotes: 1
Reputation: 1707
Well, you're just waiting for the wrong Window Title... Try WinWaitActive("AutoIt Help")
and it will work... Your "T" must be a "t"...
To find this out, you just need to check your script output and after your CHM-File has been opened you'll see that your script is still running. But you would have expected it to execute the Send(...)
and then terminate. So your script must still be waiting for the expected window to appear. Which will lead you to double check your window title, probably you'll directly copy the window title with the AutoIt Window Info Tool, and this shows your mistake. Correct it. Viola, be happy =)
Besides: You don't need to run a Command-Prompt first, you can call ShellExecute($file)
directly instead.
Upvotes: 5