Jump to content

ControlClick is killing me


Go to solution Solved by Andreik,

Recommended Posts

Hello boys!

I've discovered Auto IT 3 weeks ago and i'm in love with it 😀

Unfortunately, today is not a good day for me. Here is my problem : as you can see below, i would like to click on "Browse" using ControlClick but nothings seems to work.

I've gone through dozens of topics to solve this but i'm stuck. I've tried using ID, coordinates, WinActive, WinWaitActive ...

image.thumb.png.c30aaef84fc7326cc5291c18cd5a47d4.png

 

My script is written like this actually :

WinWait("WebClient - InstallShield Wizard", "Choose WebClient Destination Location")
ControlClick("WebClient - InstallShield Wizard", "Choose WebClient Destination Location", "[CLASS:Button; INSTANCE:5]", '"Left", 1, 399, 32)

 

This is the only part where i'm getting problem, everything includ ControlClick works perfectly on the other part of the script.

Can you please help me or give me some hints ? I've spent my whole day trying to fix this :(

 

PS: i'm a newbie in Auto IT and i don't want to use SEND ou MouseClick commands.

Link to comment
Share on other sites

11 hours ago, Andreik said:

Try this:

AutoItSetOption('WinTitleMatchMode', 2)
WinWait('WebClient')
ControlClick('WebClient', '', 'Button5')

 

Hello Andreik,

 

Tried it but still not working :(

 

10 hours ago, Danp2 said:

I would suggest checking to see if you could perform a silent install using an answer file.

P.S. It's likely that you need to run your script with Administrative privileges for the ControlClick to work correctly. Try putting the following line at the beginning of your script --

#RequireAdmin

 

Hello Danp2,

I'm already using #RequireAdmin.

Unfortunately I can't perform a silent install that's why i'm using auto IT.

Link to comment
Share on other sites

;~ Some controls will resist clicking unless they are the active window.
;~ Use the WinActivate() function to force the control's window to the top before using ControlClick().

Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

$hwin = WinWait('WebClient - InstallShield Wizard')

ConsoleWrite("WinActivate=" & WinActivate($hwin) & @CRLF)
ConsoleWrite("ControlClick=" & ControlClick($hwin, '', 'Button5') & @CRLF)

 

I know that I know nothing

Link to comment
Share on other sites

  • Solution
#RequireAdmin
AutoItSetOption('WinTitleMatchMode', 2)

$Question = 'No'
$ProxyHost = 'MyHost'
$ProxyPort = 'MyPort'
$InstallDir = @ProgramFilesDir & '\Progress Software\WebClient'
$ProgramFolder = 'PSC WebClient 11.7'
$ClientAppInstallDir = @ProgramFilesDir & '\Progress Software\WebClientApps'

$Path = '<Path to install dir>\setup.exe'

Run($Path)
WinWait('WebClient')

Do
    Sleep(10)
Until ControlGetText('WebClient', '', 'Static5') = 'Welcome to the InstallShield Wizard for WebClient'
ControlClick('WebClient', '', 'Button1')

Do
    Sleep(10)
Until ControlGetText('WebClient', '', 'Static5') = 'License Agreement'
ControlClick('WebClient', '', 'Button2')

WinWait('Question')
ControlClick('Question', '', ($Question = 'Yes' ? 'Button1' : 'Button2'))

If $Question = 'Yes' Then
    Do
        Sleep(10)
    Until ControlGetText('WebClient', '', 'Static9') = 'Proxy Server'
    ControlSetText('WebClient', '', 'Edit1', $ProxyHost)
    ControlSetText('WebClient', '', 'Edit2', $ProxyPort)
    ControlClick('WebClient', '', 'Button2')
EndIf

Do
    Sleep(10)
Until ControlGetText('WebClient', '', 'Static7') = 'Choose WebClient Destination Location'
ControlSend('WebClient', '', 'Button5', 'r')
WinWait('Choose Folder')
ControlSetText('Choose Folder', '', 'Edit1', $InstallDir)
ControlClick('Choose Folder', '', 'Button1')
ControlClick('WebClient', '', 'Button1')

Do
    Sleep(10)
Until ControlGetText('WebClient', '', 'Static8') = 'Select Program Folder'
ControlSetText('WebClient', '', 'Edit1', $ProgramFolder)
ControlClick('WebClient', '', 'Button2')

Do
    Sleep(10)
Until ControlGetText('WebClient', '', 'Static7') = 'Untranslated Message Files'
ControlClick('WebClient', '', 'Button1')

Do
    Sleep(10)
Until ControlGetText('WebClient', '', 'Static1') = 'Please choose the desired language for messages'
ControlClick('WebClient', '', 'Button4')

Do
    Sleep(10)
Until ControlGetText('WebClient', '', 'Static7') = 'Choose WebClient Applications Destination Location'
ControlSend('WebClient', '', 'Button5', 'r')
WinWait('Choose Folder')
ControlSetText('Choose Folder', '', 'Edit1', $ClientAppInstallDir)
ControlClick('Choose Folder', '', 'Button1')
ControlClick('WebClient', '', 'Button1')

Do
    Sleep(10)
Until ControlGetText('WebClient', '', 'Static6') = 'Start Copying Files'
ControlClick('WebClient', '', 'Button1')

Do
    Sleep(10)
Until ControlGetText('WebClient', '', 'Static4') = 'InstallShield Wizard Complete'
ControlClick('WebClient', '', 'Button4')

The only part that is not automated is where you have the option to choose more languages because there it's a custom component, but you should figured it out how to do it with ControlClick and some relative positions to the window.

When the words fail... music speaks.

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