Sign in to follow this  
Followers 0
Blade1

Trying to click button but nothing happens

8 posts in this topic

Hi,

I have a wizard-type GUI application and I am trying to automate it. There is a button, of which the details are below, but when I attempt to click it with the code below:

ControlClick("Gendarme", "", "[iD:198304; INSTANCE:2]")

The window's title is Gendarme so all of that is correct.

Nothing happens. Any ideas why?

Details on the specific button are in the screenshot below:

http://imageshack.us/photo/my-images/200/gendarmebuttondetails.png/

Thanks

Share this post


Link to post
Share on other sites



ControlClick("Gendarme", "", "[NAME:next_button]")

Perhaps

Hi,

That didn't work either.

Anyone know the solution?

I am executing on Windows 7 Ultimate 64 bit, is there anything I should change on the OS-level (bare in mind that although UAC is on, this isn't an issue here, obviously).

Thanks!

Share this post


Link to post
Share on other sites

ControlClick("Gendarme", "", "[CLASS:WindowsForms.10.BUTTON.app.0.2bf8098_r11_ad12; INSTANCE:2]")

etc...

try other ways too, you understand.

That didn't work either? What else can I do? :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

ControlClick("Gendarme", "", "[CLASS:WindowsForms.10.BUTTON.app.0.2bf8098_r11_ad1; INSTANCE:2]")

this?

Edited by monoscout999

Share this post


Link to post
Share on other sites

Still didn't work. :) Absolutely nothing happens.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

try this.

#include <WindowsConstants.au3>
#Include <winapi.au3>
#Include <GuiButton.au3>
#Include <array.au3>

;~ $winHndl = wingethandle("Gendarme")
;~ ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $winHndl = ' & $winHndl & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
;~ $BtnHndl = ControlGetHandle($winHndl,"","[CLASS:WindowsForms.10.BUTTON.app.0.2bf8098_r11_ad1; INSTANCE:2]")
;~ ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $BtnHndl = ' & $BtnHndl & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$winHndl = wingethandle("[CLASS:CalcFrame]")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $winHndl = ' & $winHndl & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$BtnHndl = ControlGetHandle($winHndl,"","[CLASS:Button; INSTANCE:10]")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $BtnHndl = ' & $BtnHndl & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
_sendclick()

Func _sendclick()
    Local $WM_COMMAND = 0x0111
    Local $lParam = $BtnHndl
    Local $nCtrlID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $BtnHndl)
;   _arraydisplay($nCtrlID)
    local $wParam = _WinAPI_MakeLong($nCtrlID[0], $BN_CLICKED)
    $message = _WinAPI_PostMessage($winHndl,$WM_COMMAND,$wParam,$lParam)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $message = ' & $message & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
EndFunc   ;==>_sendclick

Post the console return from SciTe.

Edited by monoscout999

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  
Followers 0