Jump to content
Sign in to follow this  
basictheprogram

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

 

Share this post


Link to post
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

Share this post


Link to post
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

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

it's UAC, see below, edited out tons of useless crapola

 

 

 

 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
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

 

Share this post


Link to post
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

 

Share this post


Link to post
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.

Share this post


Link to post
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

 

Share this post


Link to post
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.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By AutoPM
      #RequireAdmin AutoItSetOption('MouseCoordMode', 0) If WinExists("newtitle") Then ControlClick('newtitle', '', 'Button1') EndIf a Simple script to click Button on GUI with title "newtitle". this script is working fine on my laptop on [windows 10, windows 7]
      but on a different laptop. script is not clicking this button, is there any alternative to control click then please tell. don't want to use mouseclick 
       
      Thank you
    • By tentacole
      Afternoon!
      This is my first post, so I apologize if this is in the wrong place. 
      I've created a while loop to click in a certain area of an application, and have the y axis change at the end of each loop. My loop continues to click at x:27, x:10, even though the $y is adding 15 at the end of each loop. I did a Send($x) and Send($y) into a Notepad to see if the $y had changed after each loop, and the 15 was being added to $y each loop. (If this makes sense)
       
      I'm unsure where I'm going wrong, and would be extremely grateful if someone can point me in the correct direction to fix this. 
      Local $rDirectory = "H:\oDemandProject\fList.txt" Local $rLine = _FileCountLines($rDirectory) Local $x = 27 Local $y = 10 While $rline > 0 WinActivate("OnDemand", "-> 1") WinWaitActive("OnDemand", "-> 1") ControlClick("OnDemand", "", "[CLASS:AfxFrameOrView120u; INSTANCE:1]", "left", 4, $x, $y) $y += 15 $rLine -= 1 WEnd  
    • By Yirrlaar
      #Include <WinAPI.au3> local $ClassName = _WinAPI_GetClassName(WinGetHandle(WinGetTitle("[ACTIVE]"))) ControlClick(WinGetTitle("[ACTIVE]"), "", "[CLASS:"&$ClassName&"; INSTANCE:1]", "primary") When I am running this script it just gives me a ConsoleWrite output of "0x001D04A8"
      When using "AutoIT v3 Window Info" all the info I need for the ControlClick is there and displayed perfectly as if I typed it in normally.
      Upon click the button it should be clicking it, I see the following inn the console window:
      If I replace the $ClassName with the actual ClassName of "WindowsForms10.BUTTON.app.0.3296db7_r14_ad1" it works just fine, any ideas???
    • By Tats
      Hi everyone,
      I have a problem with ControlClick function. It doesn't work no matter how I tried all the possible combination of the parameters.
      Below is the scripts of possible parameter combination:
      ;ControlClick("title","text","controlID ","button","clicks","x","y") ;title= Title, Class, Handle ;controlID= Class, ClassNN, Instance ;Title here is empty when I check it with AutoIt Info ControlClick("", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("", "", "[INSTANCE:18]", "left", "1", "230","890") ;Title here is the Class of the window ControlClick("[ScreenKeyboard::SKFrame]", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("[ScreenKeyboard::SKFrame]", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("[ScreenKeyboard::SKFrame]", "", "[INSTANCE:18]", "left", "1", "230","890") ;Title here is the Handle of the window ControlClick("[0x000907A0]", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("[0x000907A0]", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("[0x000907A0]", "", "[INSTANCE:18]", "left", "1", "230","890") Am I coding it correctly?
      Thanks
    • By MaximusCZ
      Hello, and apologies if this have been discussed before, but I googled and couldnt find anything relevant.
      I have a problem where I try to send a control clink into to a window. 
      Part of window I try to send clicks to looks like this . The black border is showing when I mouse over it Au3Info, I get following information:

      I am testing its interaction with code

      The result I get is that it makes control clicks trough first line, opens and closes menus, as expected.
      When It gets to second line, it does not click a single icon. I can tell that coords are correct as the dropdown menus (No view active) gets focused(altough not rolled out). Same behaviour happens if roughly 40<y<60, so I know I am hitting good height. You can look at how it behaves here: output.webm 
      Dropdown 1 focuses at around 8 sec mark, and 13 sec mark it changes to second dropdown, defocusing first one, seemingly not registering any clinks inbetween.
       
      Have you ever encountered similar behaviour? I need to click the Key button, first on second line, with controlclick (or any other way not hijacking the mouse). I cant trigger that button by keyboard and There is no other control having control over it.
      Help
       
×
×
  • Create New...