Page 1 of 1

WindowsForms10.Window.8.app.0.34f5582_r41_ad1141

Posted: 04 Oct 2018, 01:11
by blue83
Hi,

Can anyone help me to click on this button in MS Dynamics AX?

Control is not working, yet Acc doesnt have path.

Ok, I can do it with "FindText - Capture screen image" and click, but I want that click to be inside of app? Something like COM in Internet Explorer.

Thnx

Re: WindowsForms10.Window.8.app.0.34f5582_r41_ad1141

Posted: 04 Oct 2018, 03:48
by SL5
interesting. what is this? i never saw it?

Re: WindowsForms10.Window.8.app.0.34f5582_r41_ad1141

Posted: 04 Oct 2018, 04:06
by blue83
Location of Acc is x370 y86 w127 h22

Other data can be seen from the picture.

If that is helpful?

Re: WindowsForms10.Window.8.app.0.34f5582_r41_ad1141

Posted: 04 Oct 2018, 15:48
by Frosti
Why not get a handle from it? Use it like a normal Win32 Control! Like a control named Edit3.

Code: Select all

ControlGet, Chwnd, hwnd,, WindowsForms10.Window.8.app.0.34f5582_r41_ad1141, A
Hope my code is right and you know what I mean?

Re: WindowsForms10.Window.8.app.0.34f5582_r41_ad1141

Posted: 04 Oct 2018, 15:53
by jeeswg
Perhaps consider this, if the control's class changes each time.
Being more generic when using WinActivate and ControlSetText - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 24#p186624

Re: WindowsForms10.Window.8.app.0.34f5582_r41_ad1141

Posted: 05 Oct 2018, 03:14
by Frosti
I've often have to deal with WindowsForms controls. Changing of the classNN name i've never seen, but I've never programmed a WindowsForms App. So it's unknown for me. Try jeeswg's suggestion if mine won't work over the time.

Re: WindowsForms10.Window.8.app.0.34f5582_r41_ad1141

Posted: 05 Oct 2018, 03:30
by blue83
Hi Frosti and jeeswg,

Thank you on you effort.

Frosti, I am getting hwnd (like one my first picture), but how to click based on hwnd?

jeeswg can you help me transfer me your code into my request, because ultimate goal is to click on a button.

Thank you

Re: WindowsForms10.Window.8.app.0.34f5582_r41_ad1141

Posted: 05 Oct 2018, 05:13
by jeeswg
- My script will only work if there is a control, which the AHK window spy would report.
- Otherwise see JEE_AccGetTextAll, mentioned here:
jeeswg's Acc tutorial (Microsoft Active Accessibility) (MSAA) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=40590

Re: WindowsForms10.Window.8.app.0.34f5582_r41_ad1141

Posted: 05 Oct 2018, 11:25
by Frosti
Oh sorry I leave you with a half solution. There a multiple possible ways. The safest way is to use the ControlClick command. You can use your handle or use only the classNN here.

Code: Select all

;ControlClick , Control-or-Pos, WinTitle, WinText, WhichButton, ClickCount, Options, ExcludeTitle, ExcludeText
;1. 
ControlClick,, ahk_id %Chwnd%
2.
ControlClick, WindowsForms10.Window.8.app.0.34f5582_r41_ad1141, A
There are much options left for this command in my description. For default it's send a left mouseclick.

Or you can use

Code: Select all

Mouseclick
with coordinates or you can send a message via

Code: Select all

SendMessage ; or 

Postmessage
.

I prefer ControlClick or Send/Postmessage because they set

Code: Select all

ErrorLevel
. With checking that you can control the success of your input.

Re: WindowsForms10.Window.8.app.0.34f5582_r41_ad1141

Posted: 09 Oct 2018, 01:46
by blue83
Thank you both of you.

This should work and it does in so many times, but in this case is not working.

Code: Select all

ControlClick, WindowsForms10.Window.8.app.0.34f5582_r41_ad1141, ahk_class AxMainFrame
Probably is something in app code, so I will use "FindText - Capture screen image" to resolve this situation.