Jump to content

ControlClick command or WinWaitActive command


Go to solution Solved by wklw2010,

Recommended Posts

>> Window <<<<
Title:  CADWorx 2013 Build Update  [R2] (July 23, 2013)
Class:  #32770
Position:   665, 302
Size:   590, 477
Style:  0x94C800C4
ExStyle:    0x00010101
Handle: 0x000C04A0

>>>> Control <<<<
Class:  Button
Instance:   1
ClassnameNN:    Button1
Name:   
Advanced (Class):   [CLASS:Button; INSTANCE:1]
ID: 101
Text:   @2013;1;255,0,255
Position:   218, 128
Size:   83, 50
ControlClick Coords:    39, 22
Style:  0x50030381
ExStyle:    0x00000004
Handle: 0x0058035E

>>>> Mouse <<<<
Position:   925, 477
Cursor ID:  0
Color:  0xA0A0A4

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
@2013;1;255,0,255
< &Back
&Next >
Cancel
Select AutoCAD Version

AutoCAD 2013 (64 Bit)
The following AutoCAD version(s) were detected on this machine.
Which version of AutoCAD would you like to run CADWorx with?


>>>> Hidden Text <<<<
Button2
Button3
Button4
Feature2
Feature3
Feature4
C

I am trying to either use the ControlClick command or the WinWaitActive command. I have tried all the visible text in the text field and nothing works. This is the only part of the install that is not working. I only have 2 more windows but nothing is working on this window.

 Thanks for any help...

ControlClick("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "@2013;1;255,0,255", "[CLASS:Button; INSTANCE:1]", "left", 1, 39, 26)

or 

WinWaitActive("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "@2013;1;255,0,255")
SEND("UP")
Send("enter")

post-86012-0-80286900-1401379472_thumb.j

Edited by wklw2010
Link to comment
Share on other sites

An example that may help to give some ideas

; test gui to simulate the installer window 
Global Const $GUI_ENABLE = 64
Global Const $GUI_DISABLE = 128
Opt("TrayIconDebug", 1)
Opt("GUIOnEventMode", 1)
GUICreate("CADWorx 2013 Build Update  [R2] (July 23, 2013)", 300, 200)
GUICtrlCreateLabel("Select AutoCAD Version", 5, 5)
GUICtrlCreateButton("Unknown", 5, 30)
GUICtrlSetOnEvent(Default, 'ding')
$button = GUICtrlCreateButton("&Next >", 5, 70)
GUICtrlSetOnEvent(Default, 'ding')
GUICtrlSetState($button, $GUI_DISABLE)
GUISetState()
Func ding()
    ConsoleWrite('CtrlID Event: ' & @GUI_CtrlId & @CRLF)
EndFunc

; automation
WinWait("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version")
If ControlGetFocus("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version") = "Button1" Then
    ControlSend("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version", "Button1", "{SPACE}")
    ConsoleWrite('ControlSend Event' & @CRLF)
Else
    ControlClick("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version", "Button1")
    ConsoleWrite('ControlClick Event' & @CRLF)
EndIf
GUICtrlSetState($button, $GUI_ENABLE)
While Not ControlCommand("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version", "&Next >", "IsEnabled")
    Sleep(10)
WEnd
ControlClick("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version", "&Next >")
ConsoleWrite('ControlClick Event' & @CRLF)

; finalize
Sleep(1000)
MsgBox(0, 'Installation', 'Done')

The button of interest seems to have initial focus so I considered ControlSend may help if ControlClick is not working for some reason. Your text parameter looks suspect as well compared to the picture.

Link to comment
Share on other sites

Have you tried to see if your installer supports command line? If it does, it makes things MUCH simpler and more stable.

 

Thanks for the response! I tried to create and run a response iss but once I run it, the log shows errors....

Run('C:\Users\walkersw\Desktop\Plant_PID\cadworx2013R2SP3.exe /R /f1C:\Setup.iss')

Run('C:\Users\walkersw\Desktop\Plant_PID\cadworx2013R2SP3.exe /s /f1C:\Setup.iss')
Link to comment
Share on other sites

  • Solution

An example that may help to give some ideas

; test gui to simulate the installer window 
Global Const $GUI_ENABLE = 64
Global Const $GUI_DISABLE = 128
Opt("TrayIconDebug", 1)
Opt("GUIOnEventMode", 1)
GUICreate("CADWorx 2013 Build Update  [R2] (July 23, 2013)", 300, 200)
GUICtrlCreateLabel("Select AutoCAD Version", 5, 5)
GUICtrlCreateButton("Unknown", 5, 30)
GUICtrlSetOnEvent(Default, 'ding')
$button = GUICtrlCreateButton("&Next >", 5, 70)
GUICtrlSetOnEvent(Default, 'ding')
GUICtrlSetState($button, $GUI_DISABLE)
GUISetState()
Func ding()
    ConsoleWrite('CtrlID Event: ' & @GUI_CtrlId & @CRLF)
EndFunc

; automation
WinWait("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version")
If ControlGetFocus("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version") = "Button1" Then
    ControlSend("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version", "Button1", "{SPACE}")
    ConsoleWrite('ControlSend Event' & @CRLF)
Else
    ControlClick("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version", "Button1")
    ConsoleWrite('ControlClick Event' & @CRLF)
EndIf
GUICtrlSetState($button, $GUI_ENABLE)
While Not ControlCommand("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version", "&Next >", "IsEnabled")
    Sleep(10)
WEnd
ControlClick("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version", "&Next >")
ConsoleWrite('ControlClick Event' & @CRLF)

; finalize
Sleep(1000)
MsgBox(0, 'Installation', 'Done')

The button of interest seems to have initial focus so I considered ControlSend may help if ControlClick is not working for some reason. Your text parameter looks suspect as well compared to the picture.

 

 

Try...

$hwind = WinWaitActive("CADWorx 2013 Build Update  [R2] (July 23, 2013)")

 

An example that may help to give some ideas

; test gui to simulate the installer window 
Global Const $GUI_ENABLE = 64
Global Const $GUI_DISABLE = 128
Opt("TrayIconDebug", 1)
Opt("GUIOnEventMode", 1)
GUICreate("CADWorx 2013 Build Update  [R2] (July 23, 2013)", 300, 200)
GUICtrlCreateLabel("Select AutoCAD Version", 5, 5)
GUICtrlCreateButton("Unknown", 5, 30)
GUICtrlSetOnEvent(Default, 'ding')
$button = GUICtrlCreateButton("&Next >", 5, 70)
GUICtrlSetOnEvent(Default, 'ding')
GUICtrlSetState($button, $GUI_DISABLE)
GUISetState()
Func ding()
    ConsoleWrite('CtrlID Event: ' & @GUI_CtrlId & @CRLF)
EndFunc

; automation
WinWait("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version")
If ControlGetFocus("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version") = "Button1" Then
    ControlSend("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version", "Button1", "{SPACE}")
    ConsoleWrite('ControlSend Event' & @CRLF)
Else
    ControlClick("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version", "Button1")
    ConsoleWrite('ControlClick Event' & @CRLF)
EndIf
GUICtrlSetState($button, $GUI_ENABLE)
While Not ControlCommand("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version", "&Next >", "IsEnabled")
    Sleep(10)
WEnd
ControlClick("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "Select AutoCAD Version", "&Next >")
ConsoleWrite('ControlClick Event' & @CRLF)

; finalize
Sleep(1000)
MsgBox(0, 'Installation', 'Done')

The button of interest seems to have initial focus so I considered ControlSend may help if ControlClick is not working for some reason. Your text parameter looks suspect as well compared to the picture.

WinWait("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "CADWorx 2013")
If ControlGetFocus("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "CADWorx 2013") = "Button1" Then
    ControlSend("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "CADWorx 2013", "Button1", "{SPACE}")
    ConsoleWrite('ControlSend Event' & @CRLF)
Else
    ControlClick("CADWorx 2013 Build Update  [R2] (July 23, 2013)" , "CADWorx 2013", "Button1")
    ConsoleWrite('ControlClick Event' & @CRLF)
EndIf

This Worked!!!! thanks very much

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...