Jump to content

Any way to debug controlclick()?


marko29
 Share

Recommended Posts

I am trying to pull it on control but nothing works, i am also trying to click on specified coords of a top lvl window with mousecoord opt set to 0, doesnt work either.

ControlClick("top lvl window","","[CLASS:blah; INSTANCE:65]","left", 1, 282, 129)

No idea why it wont work, perhaps control is somehow structured inside that it just decieves. Maybe you people know how to debug this or can suggest what else to try?

Oh btw i am using coords because clicking only works on specific position of control(left top)

Edited by marko29
Link to comment
Share on other sites

A few things to try:

1. Make sure you are identifying the window successfully:

$hWin = WinGetHandle("top lvl window", "")
$sTitle = WinGetTitle($hWin)
MsgBox(64, "Debug", "$hWin = " & $hWin & @CRLF & _
        "$sTitle = " & $sTitle)

2. Once you have the window handle, get the control handle to verify you have a valid ID:

#include <WinAPI.au3>

; ...

$hCtrl = ControlGetHandle($hWin, "", "[CLASS:blah; INSTANCE:65]")
$idCtrl = _WinAPI_GetDlgCtrlID($hCtrl)
$sClass = _WinAPI_GetClassName($hCtrl)
MsgBox(64, "Debug", "$hCtrl = " & $hCtrl & @CRLF & _
        "$idCtrl = " & $idCtrl & @CRLF & _
        "$sClass = " & $sClass)

3. Verify you got the X/Y coordinates correct. What kind of control is it? Did you know the coordinates are relative to the control, not the desktop or window? Is the control really that big, such that 282/129 is a valid coord inside the control?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Awesome tips psalty but i checked all things you said even before that, even i didnt do it with winapi but great debug tips anyway, i am gonna use it one time for sure. I solved this by using mouseclick() function, and yes of course with x, y relative to window, ControlClick just wouldnt wont to work, either on control or if i just did it on main window handle with setting control para to empty

Link to comment
Share on other sites

  • 2 months later...

Awesome tips psalty but i checked all things you said even before that, even i didnt do it with winapi but great debug tips anyway, i am gonna use it one time for sure. I solved this by using mouseclick() function, and yes of course with x, y relative to window, ControlClick just wouldnt wont to work, either on control or if i just did it on main window handle with setting control para to empty

I am having a similar issue i know on 64 bit Win7...havent tried it yet on 32 bit to see if the results are the same. A WinWait never identifies the window, the Adlib doesnt do what its supposed to on the windows when they pop up. I am trying to do a silent uninstall of an unapproved software :unsure:
Link to comment
Share on other sites

I am trying to do a silent uninstall of an unapproved software :>

Well now let's just talk about that part. What does "unapproved software" mean? Because it sounds malicious, and costs you any interest in any help you might want.

:unsure:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Well now let's just talk about that part. What does "unapproved software" mean? Because it sounds malicious, and costs you any interest in any help you might want.

:unsure:

Psalty, I am responsible to ensure my end users don't install software that is not approved by the company I work for. We have blocks in place to keep these things from running via ePO etc. but in order to then clean it from the systems remotely without having to force the end user to come into the office is where this comes into play for me. I create the packages to send out via SCCM and we can then do a silent uninstall. Used to be simple up to WinXP...here is the sample I have right now...the first 3 lines should be enough but the uninstall doesnt go silent...causes 3 prompts. This app is considered spyware according to threatexpert: (I am not one to just drop links into forums :>)

#RequireAdmin

AdlibRegister("MyAdlib")

Run(@ProgramFilesDir & '\Software Informer\unins000.exe /S /v')

WinWait('Software Informer Uninstall','Software Informer uninstall complete.')

Func myadlib()

If WinExists('Uninstall', 'Would you like to keep your settings?') Then

WinActivate('Uninstall', 'Would you like to keep your settings?')

ControlClick('Uninstall', '&No', 1)

EndIf

If WinExists('Software Informer Uninstall', '&Yes') Then

WinActivate('Software Informer Uninstall', '&Yes')

ControlClick('Software Informer Uninstall', '&Yes', 1)

EndIf

If WinExists('Software Informer Uninstall','Software Informer uninstall complete.') Then

ControlClick('Software Informer Uninstall', '&Ok', 1)

EndIf

EndFunc ;==>myadlib

Link to comment
Share on other sites

Use the advanced window spec to get the handle first, as in Example 2 of post #3. For class and useful identifying info check out the popup with AU3Info. That will at least verify if you can ID the window and control. If you still can't simply get the window and button control handles, post the Summary Tab info from AU3Info.

Since you launched the process in the first place, I don't think you need any more privilege escalation to see and work with the windows.

:unsure:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

My bad...just goes to show you that even when you think you know what youre doing, you (me) can still screw up...controlclick on the control number fixed the whole dang thing...thanks for making me go back and RTM. :unsure:

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