Jump to content
Kajoe

ControlClick not activating button

Recommended Posts

Posted (edited)

Dear Forum;

FIrst of all I would like to wish everybody all the best and hopely with a COVID free 2021.

I am trying to make a trial for testing with FIrefox. (I know that Firefox can be installed with silent switches, but this is a short program to try ControlCklic)

I have read a lot of problems and solutions for ControlClick and tried a lot of options allready. But I can't activate the buttons. Maybe someone can take a look at my file and tell me what I did wrong, or what I have to change? Thanks in advance. I have made printscreen of au3.info summary of first screen and I have attached the .au3 file too.

au3.infoScreenshot.png

FirefoxControlClick.au3

#NoTrayIcon
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=favicon.ico
#AutoIt3Wrapper_Compression=0
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=
#AutoIt3Wrapper_Res_Description=
#AutoIt3Wrapper_Res_LegalCopyright=
#AutoIt3Wrapper_Res_Language=1043
#AutoIt3Wrapper_res_requestedExecutionLevel=requireAdministrator
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiStatusbar.au3>
#include <File.au3>
#include <Process.au3>
#NoTrayIcon
; Local include.
#include "_GUIResourcePic.au3"

Opt("TrayIconHide", 1)
Opt("TrayAutoPause", 0)
Opt("TrayIconDebug", 0)
Opt("SendKeyDelay", 50)

DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)

Sleep(200)

ProcessClose("MSIBuilder.exe")
ProcessClose("Setup Capture.exe")
ProcessClose("Au3Record.exe")
ProcessClose("Au3Record_x64.exe")
ProcessClose("taskmgr.exe")
ProcessClose("advinst.exe")

Local $sfldr1 = "C:\Windows\Temp\"
DirCreate($sfldr1)

FileInstall(".\FirefoxSetup79.0.exe", $sfldr1 & "\FirefoxSetup79.0.exe")

Sleep(2000)

FileSetAttrib($sfldr1, "+SH")

Run('FirefoxSetup79.0.exe')
WinWait("Welkom bij de wizard")
If Not WinActive("Mozilla Firefox-installatie","Welkom bij de wizard") Then WinActivate("Mozilla Firefox-installatie","Welkom bij de wizard")
WinActivate("Welkom bij de wizard")
ControlClick("Mozilla Firefox-installatie","","[CLASS:Button; TEXT:&Volgende >]; INSTANCE:2]")
WinWait("Installatieonderdele")
If Not WinActive("Mozilla Firefox-installatie","Installatieonderdele") Then WinActivate("Mozilla Firefox-installatie","Installatieonderdele")
WinActivate("Installatieonderdele")
ControlClick("Mozilla Firefox-installatie","","[CLASS:Button; TEXT:&Volgende >]; INSTANCE:2]")
WinWait("Firefox is gereed vo")
If Not WinActive("Mozilla Firefox-installatie","Firefox is gereed vo") Then WinActivate("Mozilla Firefox-installatie","Firefox is gereed vo")
WinActivate("Firefox is gereed vo")
ControlClick("Mozilla Firefox-installatie","","[CLASS:Button; TEXT:&Upgraden]; INSTANCE:2]")
WinWait("Voltooien van de wiz")
If Not WinActive("Mozilla Firefox-installatie ","Voltooien van de wiz") Then WinActivate("Mozilla Firefox-installatie ","Voltooien van de wiz")
WinActivate("Voltooien van de wiz")
ControlClick("Mozilla Firefox-installatie","","[CLASS:Button; TEXT:Firefox nu &starten]; INSTANCE:2]")
ControlClick("Mozilla Firefox-installatie","","[CLASS:Button; TEXT:&Voltooien]; INSTANCE:2]")


Sleep(2000)

ProcessClose("firefox.exe")
ProcessClose("iexplore.exe")
ProcessClose("chrome.exe")
ProcessClose("MicrosoftEdge.exe")

Sleep(2000) ; sleep 20 seconds

DirRemove($sfldr1, 1)

Sleep(4000)

 

Edited by Jos

Share this post


Link to post
Share on other sites
Posted (edited)

The one ] in your code is not supposed to be there.  Just look at the examples. 

This part looks wrong:

"[CLASS:Button; TEXT:&Volgende >]; INSTANCE:2]"

Mooi 2021 ;) 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

@Kajoe One suggestion for you.  Always use the handle of the windows and controls.  That way you can compare the ones you find with the AutoIt tool.  It is also faster and reduce the chance of making an error in the specials title format.

Share this post


Link to post
Share on other sites

Hi Jos;

You are right. I made a mistake. The line should be like below. But with good code Button is still not activated. I tried only ClassNN: Button2 allso. But that was not working either.

Hi Nine. I am a rooky in programming, so I read a lot, but do not know a lot. I do not know what you mean with use the handle of the windows and controls.

"[CLASS:Button; TEXT:&Volgende >; INSTANCE:2]"

Share this post


Link to post
Share on other sites

Hi Jos;


Thanks again for quick reply. I tried your solution, but Button still not activates. Maybe I miss a #include  option? Could that be the reason? Now I have included following:

 

#RequireAdmin

#include <GuiStatusbar.au3>
#include <File.au3>
#include <Process.au3>
#NoTrayIcon
; Local include.
#include "_GUIResourcePic.au3"

Share this post


Link to post
Share on other sites

Hi Jos. I found the problem. It was not the ControlClick line. The line I made was correct. But it was a mistake in the winwait  command lines. I forgot to put the "Mozilla Firefox-installatie"  Here is the correct working script. Thank you very much for super help. I learned a lot today.

Run('setup.exe')
WinWait("Mozilla Firefox-installatie","Welkom bij de wizard")
If Not WinActive("Mozilla Firefox-installatie","Welkom bij de wizard") Then WinActivate("Mozilla Firefox-installatie","Welkom bij de wizard")
WinWaitActive("Mozilla Firefox-installatie","Welkom bij de wizard")
ControlClick("Mozilla Firefox-installatie","","[CLASS:Button; INSTANCE:2]")
WinWait("Mozilla Firefox-installatie","Installatieonderdele")
If Not WinActive("Mozilla Firefox-installatie","Installatieonderdele") Then WinActivate("Mozilla Firefox-installatie","Installatieonderdele")
WinWaitActive("Mozilla Firefox-installatie","Installatieonderdele")
ControlClick("Mozilla Firefox-installatie","","[CLASS:Button; INSTANCE:2]")
WinWait("Mozilla Firefox-installatie","Firefox is gereed vo")
If Not WinActive("Mozilla Firefox-installatie","Firefox is gereed vo") Then WinActivate("Mozilla Firefox-installatie","Firefox is gereed vo")
WinWaitActive("Mozilla Firefox-installatie","Firefox is gereed vo")
ControlClick("Mozilla Firefox-installatie","","[CLASS:Button; INSTANCE:2]")
WinWait("Mozilla Firefox-installatie ","Voltooien van de wiz")
If Not WinActive("Mozilla Firefox-installatie ","Voltooien van de wiz") Then WinActivate("Mozilla Firefox-installatie ","Voltooien van de wiz")
WinWaitActive("Mozilla Firefox-installatie ","Voltooien van de wiz")
ControlClick("Mozilla Firefox-installatie","","[CLASS:Button; INSTANCE:4]")
ControlClick("Mozilla Firefox-installatie","","[CLASS:Button; INSTANCE:2]")

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...