Jump to content
Sign in to follow this  
Kintar

Problems with clicking

Recommended Posts

Kintar

So.

;WinActivate (":: E-Trade PriceList Importer 1.9.0 Импорт / Экспорт прайс листов поставщиков http://www.elbuz.com База данных: UNIT")

if not ControlClick (":: E-Trade PriceList Importer 1.9.0 Импорт / Экспорт прайс листов поставщиков http://www.elbuz.com База данных: UNIT","","[CLASS:AfxWnd42; INSTANCE:3]", "left", 1, 245, 14) Then

MsgBox (4096, "error", "ooops!")

EndIf

MouseMove (424, 84, 0)

MouseClick ("left", 424, 84, 2)

This is sample.

In theory, this code should Click on my button in two different ways. Really, it's do nothing. Control Click didn't return error, so - it's right name of window and control. Moreover, when i activate my window on start of a program, MouseMove didn't move the mouse, too.

I have two questions - 1) What it can be?

and 2)What can i do?

Share this post


Link to post
Share on other sites
PsaltyDS

What are those X/Y coordinates relative to, and why did you bother with them? I would break it into parts for diagnosis: Get Hwnd of window, then of control, then use that to try the click, displaying results along the way:

Global $sWinTitle = ":: E-Trade PriceList Importer 1.9.0 (etc.)", $hWin
Global $sCtrlSpec = "[CLASS:AfxWnd42; INSTANCE:3]", $hCtrl
Global $iRet

$hWin = WinGetHandle($sWinTitle, "")
ConsoleWrite("$hWin = " & $hWin & @LF)
$hCtrl = ControlGetHandle($hwin, "", $sCtrlSpec)
ConsoleWrite("$hCtrl = " & $hCtrl & @LF)
$iRet = ControlClick($hwin, "", $hCtrl)
ConsoleWrite("$iRet = " & $iRet & @LF)

:mellow:


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

Share this post


Link to post
Share on other sites
Kintar

What are those X/Y coordinates relative to, and why did you bother with them? I would break it into parts for diagnosis: Get Hwnd of window, then of control, then use that to try the click, displaying results along the way:

Global $sWinTitle = ":: E-Trade PriceList Importer 1.9.0 (etc.)", $hWin
Global $sCtrlSpec = "[CLASS:AfxWnd42; INSTANCE:3]", $hCtrl
Global $iRet

$hWin = WinGetHandle($sWinTitle, "")
ConsoleWrite("$hWin = " & $hWin & @LF)
$hCtrl = ControlGetHandle($hwin, "", $sCtrlSpec)
ConsoleWrite("$hCtrl = " & $hCtrl & @LF)
$iRet = ControlClick($hwin, "", $hCtrl)
ConsoleWrite("$iRet = " & $iRet & @LF)

Those X/Y coordinates are relative to my control. I typed it two times, because try to test mouseclick some time before my testing of mousemove. So, coordinates in mousemove is useless, and i knew it.

hWin =

hCtrl =

iRet = 1

This is output of this code.

Share this post


Link to post
Share on other sites
PsaltyDS

OK, no point in worrying about ControlClick() until you can correctly ID the window, and WinGetHandle() failed right off the bat. Post the contents of the window tab in AU3Info.exe so we can see how best to ID the window.

FYI: ControlClick() only returned 1 because the null $hWin and $hCtrl caused it to default to the current active window, as though the call was just ControlClick("", "", "").

:mellow:


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

Share this post


Link to post
Share on other sites
Kintar

Thanks.

>>>> Window <<<<

Title: :: E-Trade PriceList Importer 1.9.0 Импорт / Экспорт прайс листов поставщиков http://www.elbuz.com База данных: UNIT

Class: E-TRADE P9c000000

Position: -4, -4

Size: 1288, 764

Style: 0x17CF0000

ExStyle: 0x00040104

Handle: 0x00000000003D08C8

>>>> Control <<<<

Class: AfxWnd42

Instance: 3

ClassnameNN: AfxWnd423

Name:

Advanced (Class): [CLASS:AfxWnd42; INSTANCE:3]

ID:

Text:

Position: 0, 54

Size: 1280, 27

ControlClick Coords: 378, 16

Style: 0x56000000

ExStyle: 0x00000004

Handle: 0x00000000002809CE

>>>> Mouse <<<<

Position: 378, 89

Cursor ID: 0

Color: 0xA5C3EF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

>>>> Hidden Text <<<<

It's summary of my window by autoitinfo.

Share this post


Link to post
Share on other sites
PsaltyDS

Well, the Cyrillic throws off my code pages and I get ????? for it. You didn't leave "(etc.)" literally in there did you? The substring ":: E-Trade PriceList Importer 1.9.0" should have worked fine.

Another way to match might be by just using class/instance: $hWin = WinGetHandle("[CLASS:E-TRADE P9c000000; INSTANCE:1]", "")

Or, if you want to get really down and geeky, by RegExpTitle:

#Include <GuiConstantsEx.au3>

$hWin = GUICreate(":: E-Trade PriceList Importer 1.9.0 ?????? / ??????? ????? ?????? ??????????? http://www.elbuz.com ???? ??????: UNIT", 600, 300)
ConsoleWrite("$hWin = " & $hWin & @LF)
GUISetState()

$hTest = WinGetHandle("[REGEXPTITLE::: E-Trade PriceList Importer 1.9.0 .+ http://www.elbuz.com .+ UNIT]", "")
ConsoleWrite("$hTest = " & $hTest & "; @error = " & @error & @LF)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

:mellow:

Edited by PsaltyDS

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

Share this post


Link to post
Share on other sites
Kintar

Sorry, have some another problems and didn't recognize "etc." in title.....

Now, i have normal return

$hWin = 0x00000000004F04F0

$hCtrl = 0x0000000000220ABA

$iRet = 1

But it still do nothing, even when i point right coordinates to my control click..

Edited by Kintar

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.