Jump to content

ControlClick doesn't work


Recommended Posts

GYou can you can PM me your log results and will take a look at what’s happening. Also run the editor as admin and run the installer as admin from the beginning. Make sure to uninstall the driver and the initial installer for each test run

 

Send me the log file

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Fresh vagrant up of Windows Server 2016, few tools installed but EasyLogUSB not installed.

chocolatey_test_environment_windows_2016__Running_.thumb.png.4c941745d533c097f759afab66021190.png

Logged in as the Local Administrator

 

PS C:\Users\Administrator\AppData\Local\Temp\2\chocolatey\EasyLogUSB.7.6.0> whoami
vagrant\administrator

Confirmed running SciTE as local Administrator

Confirmed Running the EasyLogUSB+Installer.exe as Administrator

Using the code below

#AutoIt3Wrapper_Compression=3
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#AutoIt3Wrapper_Add_Constants=n
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#RequireAdmin

#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include 'log4a.au3'
#include 'WaitForControls.au3'

Global $TD_BTN_NEXT = '&Next >'
Global $TD_BTN_INSTALL = '&Install'
Global $TD_BTN_INSTALL2 = 'Install'
Global $TD_BTN_FINISH = '&Finish'
Global $TD_BTN_CANCEL = 'Cancel'
Global $TD_BTN_IAGREE = "I &accept the terms in the license agreement"
Global $TD_BTN_ALTFINISH = '&Finish'
Global $TD_BTN_ALLOW_ACCESS = '&Allow access'
Global $TD_BTN_REMOVE = '&Remove'
Global $TD_BTN_YES = '&Yes'
Global $TD_BTN_OK = 'OK'
Global $TD_BTN_TYPICAL = '&Typical'
Global $TD_EDIT_DATA = '99999'
Global $TD_TREE_NAME = 'Tree1'

Global $apptext = 'EasyLog USB Device Driver Installer'
Global $text = "EasyLog USB - InstallShield Wizard"
Global $class = "[CLASS:MsiDialogCloseClass]"
Global $stdClass = '[Class:#32770]'
Global $button1 = "[CLASS:Button; INSTANCE:1]"
Global $button2 = "[CLASS:Button; INSTANCE:2]"
Global $button3 = "[CLASS:Button; INSTANCE:3]"
Global $button4 = "[CLASS:Button; INSTANCE:4]"
Global $button5 = "[CLASS:Button; INSTANCE:5]"

#Region ;**** Logging ****
; Enable logging and don't write to stderr
_log4a_SetEnable()
; Write to stderr, set min level to warn, customize message format
_log4a_SetErrorStream()
_log4a_SetCompiledOutput($LOG4A_OUTPUT_FILE)
_log4a_SetMinLevel($LOG4A_LEVEL_DEBUG)
; If @compiled Then _log4a_SetMinLevel($LOG4A_LEVEL_WARN) ; Change the min level if the script is compiled
_log4a_SetFormat("${date} | ${host} | ${level} | ${message}")
#EndRegion ;**** Logging ****


Func Install()
    Local $handle = WinActivate($text)
    _log4a_Info($handle)
    _log4a_Info('Begin Install()')
    _checkClickCtrl($class, $text, $button1, $TD_BTN_NEXT, 0)
    _checkClickCtrl($class, $text, $button3, $TD_BTN_IAGREE, 0)
    _checkClickCtrl($class, $text, $button5, $TD_BTN_NEXT, 0)
    _checkClickCtrl($class, $text, $button1, $TD_BTN_INSTALL, 0)
    _checkClickCtrl($class, $text, $button1, $TD_BTN_FINISH, 0)
    _checkClickCtrl($stdClass, $apptext, $button1, $TD_BTN_INSTALL2, 0)
    _checkClickCtrl($stdClass, 'Success', $button1, $TD_BTN_OK, 0, 3)

    _log4a_Info('End Install()')

EndFunc

Install()

Putting the console output into a gist

https://gist.github.com/basictheprogram/f921514460f3f99fcb0247b312069c63

Now the EasyLog USB Device Driver Installer dialog remains until I click the Install button and the next gist shows the console output

https://gist.github.com/basictheprogram/500ddaefbf471360595701abcfe0871a

Link to comment
Share on other sites

The log says that it found that Install button and then it clicked it at the end of your first gist  In fact the whole run look successful as does the second

The second gist looks correct with the correct output all the way thru

 

Uninstall the application and close the editor then run the application installer and fire up the autoit editor and hit F5 and don’t touch kb or mouse. It should work

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Failure. I wonder if this is a Windows Server 2016 issue?

Same results.

Logged in as the Local Administrator

Confirmed running SciTE as local Administrator

Confirmed Running the EasyLogUSB+Installer.exe as Administrator

Hit F5 everything works until the Device Driver installer

Link to comment
Share on other sites

ok, here is the problem, that stupid msi installer--the first one-- you launch in admin mode, but it is not launching the OTHER driver installer in admin, if you do that manually and run the last two lines in the install function inside an admin SciTE session, it works like a charm! So, we will have to kill that spawned process in our code, the driver installer process if we can, then launch it ourselves from our admin level script, and then UAC will be satisfied.

UDATE! Got it working with UAC, now to test with other vms with UAC set to normal, make sure to use the latest WaitForControls above too for better logging. This should work for you. Make sure to send Udi's Gluten Free donuts soon... thanks.. kidding, lol.

Get the latest code and what I have attached, the easiest way is to compile the script and run it will ask for elevation and execute and provide you a nice log file. it's easier for me than opening an editor in admin and all the mumbo jumbo that goes with that.

#AutoIt3Wrapper_Compression=3
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#AutoIt3Wrapper_Add_Constants=n
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#RequireAdmin

#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include 'log4a.au3'
#include 'WaitForControls.au3'

Const $TD_BTN_NEXT = '&Next >'
Const $TD_BTN_INSTALL = '&Install'
Const $TD_BTN_INSTALL2 = 'Install'
Const $TD_BTN_FINISH = '&Finish'
Const $TD_BTN_CANCEL = 'Cancel'
Const $TD_BTN_IAGREE = "I &accept the terms in the license agreement"
Const $TD_BTN_ALTFINISH = '&Finish'
Const $TD_BTN_ALLOW_ACCESS = '&Allow access'
Const $TD_BTN_REMOVE = '&Remove'
Const $TD_BTN_YES = '&Yes'
Const $TD_BTN_OK = 'OK'
Const $TD_BTN_TYPICAL = '&Typical'
Const $TD_EDIT_DATA = '99999'
Const $TD_TREE_NAME = 'Tree1'

Const $apptext = 'EasyLog USB Device Driver Installer'
Const $text = "EasyLog USB - InstallShield Wizard"
Const $class = "[CLASS:MsiDialogCloseClass]"
Const $stdClass = '[Class:#32770]'
Const $button1 = "[CLASS:Button; INSTANCE:1]"
Const $button2 = "[CLASS:Button; INSTANCE:2]"
Const $button3 = "[CLASS:Button; INSTANCE:3]"
Const $button4 = "[CLASS:Button; INSTANCE:4]"
Const $button5 = "[CLASS:Button; INSTANCE:5]"

#Region ;**** Logging ****
; Enable logging and don't write to stderr
_log4a_SetEnable()
; Write to stderr, set min level to warn, customize message format
_log4a_SetErrorStream()
_log4a_SetCompiledOutput($LOG4A_OUTPUT_FILE)
_log4a_SetMinLevel($LOG4A_LEVEL_DEBUG)
; If @compiled Then _log4a_SetMinLevel($LOG4A_LEVEL_WARN) ; Change the min level if the script is compiled
_log4a_SetFormat("${date} | ${host} | ${level} | ${message}")
#EndRegion ;**** Logging ****


Func Install()
    Local $handle = WinActivate($text)
    _log4a_Info($text & ' Handle :' & $handle)
    _log4a_Info('Begin Install()')
    _checkClickCtrl($class, $text, $button1, $TD_BTN_NEXT, 0)
    _checkClickCtrl($class, $text, $button3, $TD_BTN_IAGREE, 0)
    _checkClickCtrl($class, $text, $button5, $TD_BTN_NEXT, 0)
    _checkClickCtrl($class, $text, $button1, $TD_BTN_INSTALL, 0)
    _checkClickCtrl($class, $text, $button1, $TD_BTN_FINISH, 0)

    $handle = WinActivate($apptext)
    _log4a_Info($apptext & ' Handle :' & $handle)
    Local $IsActive = WinActive($handle)

    If ($IsActive) Then
        ProcessClose("EL-USB Driver Setup.exe")
        Sleep(3000)
        ;~ Note that we could also look up the path from registry of the main installer here in case a custom install location was set on the first msi
        ;~ Also we could have just silent installed the first msi I think, lol, but, you need to learn.
        Run("C:\Program Files (x86)\EasyLog USB\EL-USB Driver Setup.exe")

        $handle = WinActivate($apptext)
        _log4a_Info($apptext & ' Handle :' & $handle)

        _checkClickCtrl($stdClass, $apptext, $button1, $TD_BTN_INSTALL2, 0)
        _checkClickCtrl($stdClass, 'Success', $button1, $TD_BTN_OK, 0)
    EndIf

    _log4a_Info('End Install()')

EndFunc   ;==>Install

Install()

 

You can integrate the UAC UDF from this forum to deal with the UAC prompts I believe, though I have never done it.

WaitForControls.au3

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

NO. already tried for the second one--there is no silent install for that POS, maybe for the first it's possible, and why ditch the code? it works great. If we get it working we can look at installing the first msi silent. this is development.

easiest thing is ditch UAC, which is probably not an option, and I have never used the UAC udf so i don't know if it can get around the popups, or at least let me click them--but probably not I think. anyway drivers should always be made to manually install only due to security. I think UAC is doing it's job nicely.

feel free to jump in if so inclined..... always appreciate help

what's all that code? the two main files are TINY and you can build installers for anything using the same pattern. excluding the logger which I did not write it's 7 kb of code, not even 135 lines code (mostly comments) total with professional output and it's solid on all OS--have not tested XP which I don't care about, nor Win7 soon once the nails are final in the coffin--but i did test on Win7

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

My 2 cents. Use control id rather than instances. Instances change, more frequently than ids. 2: why do you grab the handle to a window and then use a window class to identify the window?  if you have the specific handle, use it.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Instances of an existing window and control do not change at all and this method has never failed me. The only way they would change is if a developer change them but thanks anyway it will be taken under advisement and the UDF can be improved

I don’t know why I kept the handles in that example  

 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Instances can change all the time.  maybe not this specific application, but I've automated apps that have permissions that create or remove buttons. The instances WILL change, the ids will not.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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

×
×
  • Create New...