HwndWrapper and ControlFocus

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ryjames
Posts: 2
Joined: 18 May 2018, 15:57

HwndWrapper and ControlFocus

18 May 2018, 17:25

If I use Active Window Info (Window Spy) to look at a field, it's ClassNN shows:
HwndWrapper[Trebuchet.App.exe;Cherwell 1;5be27849-1217-4b27-ae1f-0652209e09b2]1

How would I use ControlFocus to move the text cursor to it?

It's easy with one that lists this as its ClassNN:
WindowsForms10.EDIT.app.0.17e61ce_r12_ad11

Any thoughts? Thank you in advance!
burque505
Posts: 1732
Joined: 22 Jan 2017, 19:37

Re: HwndWrapper and ControlFocus

18 May 2018, 17:56

Hi, ryjames, this looks like something to do with Cherwell Service Management installation, might that be right?I think what you need is this:
First, ControlGet
Retrieves the window handle (HWND) of the specified control.
So, maybe, unless that's a child, something like this;

Code: Select all

ControlGet, TrebuchetWindowHwnd, Hwnd, , HwndWrapper[Trebuchet.App.exe;Cherwell 1;5be27849-1217-4b27-ae1f-0652209e09b2]1, TheTitleWhateverItIs
If that's some kind of child my feeble attempt may be worthless, and I likely missed a comma, I have no way to test this at the moment. Also take a look here:
Lexikos's posts.
(Especially regarding 'WinGet ControlList', and the example below that.)
Anyway, once you get the Hwnd, then:

Code: Select all

ControlFocus, ,TrebuchetWindowHwnd
Hope I'm not giving you a bum steer, which considering I've got no way to test this is possible (maybe even likely). I think you're close anyway.
Regards,
burque505
ryjames
Posts: 2
Joined: 18 May 2018, 15:57

Re: HwndWrapper and ControlFocus

22 May 2018, 11:16

Thank you for the suggestion! I tried it out and it doesn't find it still.

As an experiment, I tried:

Code: Select all

	ControlGetFocus, CurrentControl, Cherwell
	Control, EditPaste, %SendWhat%, %CurrentControl%, Cherwell
This also did not work :(

I'm not sure what the trick is.

Thank you again for the suggestion!

Also, I did try printing out a complete control list and it shows up the same for that control as it does from the spy.

One other weird thing is that if I search for the coordinates of the control with a loop, it finds 2 results. One is the same hwndwrapper string as above, but the other one looks like the kind that works starting with WindowsForms10.Window... etc.
But even if I try to send focus to that, it does not work.

If it didn't work so well for other fields, I wouldn't be so stuck on making this work! haha :)

Any suggestions are welcome!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 91 guests