Jump to content

Cannot SEND commands to Active Window


Recommended Posts

I am attempting to kick off an application with my script, change the value of a drop-down menu and click a couple of buttons. THe application opens. I used Au3recorder to get the code for the dropdown and button presses. The applcation opens, but none of the send commands are working. Even when I used mouseclicks, those did not work. Below is the snippet of the script.

#include <GUIConstants.au3>

#include <Array.au3>

#include <WinAPI.au3>

#include <WindowsConstants.au3>

#include <EditConstants.au3>

#include <TabConstants.au3>

#include <UpDownConstants.au3>

#RequireAdmin

#NoTrayIcon

$debugging = True

FileChangeDir (@ScriptDir)

; Enabling USB Write

RunWait (@ComSpec & " /c Enablewrite.bat","",@SW_SHOW)

; Programming USB Plunger

WinWait("Delcom Setup Utility Ver 1.0","Device Name: \\?\hid")

WinActivate("Delcom Setup Utility Ver 1.0","Device Name: \\?\hid")

MouseClick("left",204,182,1)

MouseClick("left",176,314,1)

MouseClick("left",401,331,1)

WinWait("Program Manager","FolderView")

WinActivate("Program Manager","FolderView")

MouseClick("left",42,93,1)

WinWait("Confirm","Program device with ")

WinActivate("Confirm","Program device with ")

MouseClick("left",50,94,1)

WinWait("Delcom Setup Utility Ver 1.0","Device Name: \\?\hid")

WinActivate("Delcom Setup Utility Ver 1.0","Device Name: \\?\hid")

MouseMove(26,40)

MouseDown("left")

MouseMove(25,39)

MouseUp("left")

MouseClick("left",559,335,1)

RunWait (@ComSpec & " /c Disablewrite.bat","",@SW_SHOW)

----------------------------------------------------------------------------------------------------------------------------

I've also tried it this way:

#include <GUIConstants.au3>

#include <Array.au3>

#include <WinAPI.au3>

#include <WindowsConstants.au3>

#include <EditConstants.au3>

#include <TabConstants.au3>

#include <UpDownConstants.au3>

#RequireAdmin

#NoTrayIcon

$debugging = True

FileChangeDir (@ScriptDir)

; Enabling USB Write

RunWait (@ComSpec & " /c Enablewrite.bat","",@SW_SHOW)

; Programming USB Plunger

WinWaitActive("Delcom Setup Utility Ver 1.0","Device Name: \\?\hid")

Send("{TAB}{TAB}{TAB}{TAB}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}")

WinWaitActive("Program Manager","FolderView")

Send("{ENTER}")

WinWaitActive("Delcom Setup Utility Ver 1.0","Device Name: \\?\hid")

Send("{TAB}{ENTER}")

RunWait (@ComSpec & " /c Disablewrite.bat","",@SW_SHOW)

Link to comment
Share on other sites

Does using the Window Info tool give you the control IDs/Classes of the dropdowns and buttons? Using strictly coordinates and TABing isn't generally the way you would want to approach it unless you absolutely have to.

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

  • Moderators

Hi, dachizzla, welcome to the forum. I think Control commands will serve you better for this application. If you use the AutoIt Window Info tool (Inside the AutoIt directory: Au3Info.exe), you'll see that every drop-down and checkbox has an ID. This app almost looks like an AutoIt tool, so you should easily be able to find the ID and then Use a ControlSend or other method to interact with it.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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