Sign in to follow this  
Followers 0
sysadmin

Controlling a button

3 posts in this topic

I have been writing a script to interface with a software's GUI. I have one last step that I'm stumped on. Ive attached two files of screen shots of the info on what I'm trying to do. Attachment "File1" shows the last step on my navigation along with the window info tool. Once auto it changes the info that I need I need to click the "OK" at the bottom of the window. I have tried every combination of commands to navigate around and click on this button, but nothing seems to work. File2 shows the window info tool of the button I need to click on. Any Ideas?

#include <File.au3>
#include <Array.au3>
#include <Excel.au3>

; opens excel workbook
;REST THE WORKBOOK FOR YOUR FILE PATH AND NAME
Local $oExcel = _ExcelBookOpen("C:\autoit\searchresultstest.xls")
; reads data into array
$aArray1 = _ExcelReadSheetToArray($oExcel, 1, 1, 0, 1, True)
; closes the excel workbook
_ExcelBookClose($oExcel)
; displays the array that was read.
_ArrayDisplay($aArray1)
; counts the number of rows in the array
$rows = UBound($aArray1) - 1

; waits for Corridor to become active and maximizes the window
WinActive("CORRIDOR", "")
WinSetState("CORRIDOR", "", @SW_MAXIMIZE)

; finds the window called Corridor and navigates to the parts in inventory
WinActivate("CORRIDOR", "")
Send("!t")
Send("{down 2}")


Send("{right}")
Send("{down 3}")
Send("{ENTER}")

; waits for the Corridor Parts in Inventory to be active
WinWaitActive("CORRIDOR", "", 5)
WinActivate("Current Parts in Inventory Search", "")

;Navigates to Part tab and lot number field
WinWaitActive("CORRIDOR", "", 5)
Sleep(500)
ControlCommand("Current Parts in Inventory Search", "", "SysTabControl323", "TabRight", "")
Sleep(500)
Send("{TAB}")


For $c = 1 To $rows

    WinWaitActive("Current Parts in Inventory Search", "Lot number:", 5)
    ControlClick("Current Parts in Inventory Search", "Lot number:", 1070, "left")

    ;Loads up lot number
    ControlSend("Current Parts in Inventory Search", "Lot number:", 1070, $aArray1[$c][0])
    Sleep(250)
    ControlClick("Current Parts in Inventory Search", "Lot number:", 1063, "left")
    Sleep(250)
    ControlClick("Current Parts in Inventory Search", "Lot number:", 1663, "left")


    WinWaitActive("Edit Lot", "Lot number:", 10)

    ;set new owner and vendor

    ControlClick("Edit Lot", "Lot number:", 1053)
    Send("{TAB}")
    ControlSend("Edit Lot", "Lot number:", 1082, "{DEL}TEST")
    Send("{TAB}")
    ControlSend("Edit Lot", "Lot number:", 1142, "{DEL}TEST")


    ;changes aircraft serial number
    ControlCommand("Edit Lot", "", "SysTabControl321", "TabRight", "")
    ControlCommand("Edit Lot", "", "SysTabControl321", "TabRight", "")
    ControlCommand("Edit Lot", "", "SysTabControl321", "TabRight", "")
    ControlCommand("Edit Lot", "", "SysTabControl321", "TabRight", "")
    Send("{TAB 4}")
    Send("{ENTER}")
    Send("{DOWN}")
    Send("{ENTER}")
    Send("{TAB}")

    ;Click OK

    ControlClick("Edit lot", "OK", 1, "left")

    ;wait to get back to search dialog
    WinWaitActive("Current Parts in Inventory Search", "Lot number:", 5)
    Send("{ALT}s" & "n")

Next

MsgBox(0, "Lot Updater", $rows & " lots have been updated.")

post-63891-0-41433000-1302530613_thumb.j

post-63891-0-39790100-1302530628_thumb.j

Share this post


Link to post
Share on other sites



Can you press ALT+O and have the OK button press? If so use a the Send or ControlSend command to send that key combo to the window.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

No the ALT+O control does not work. What is making this so difficult the dropdown doesnt have its own control id. The navigation gets a little tricky for making the selection. I've tried sending a control click to another field and then the control click to the ok button, but I still get nothing.

Share this post


Link to post
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
Sign in to follow this  
Followers 0