Sign in to follow this  
Followers 0
Jury

ControlSend help

7 posts in this topic

With the window info at the bottom of this message why can't I get ControlSend to work? As you can see I've tried various things such as WinActivate, ControlClick, etc. There seem to be many options for addressing the Window Controls I'm confused.

;WinActivate("Is it on BAILII?; CLASS:AutoIt v3 GUI; INSTANCE:1", "")
;ControlFocus("Is it on BAILII?","Type/Paste citation here", "Edit1")

ControlSend("Is it on BAILII?", "Type/Paste citation here", "Edit1", "[2010] EWMC 222 (FPC)")

;ControlClick("Is it on BAILII?", "", "[ID:3]")

>>>> Window <<<<

Title: Is it on BAILII?

Class: AutoIt v3 GUI

Position: 1474, 314

Size: 337, 99

Style: 0x94C80000

ExStyle: 0x00000108

Handle: 0x00140680

>>>> Control <<<<

Class: Edit

Instance: 1

ClassnameNN: Edit1

Advanced (Class): [CLASS:Edit; INSTANCE:1]

ID: 3

Text: Type/Paste citation here

Position: 8, 8

Size: 273, 41

ControlClick Coords: 180, 17

Style: 0x50030004

ExStyle: 0x00000200

Handle: 0x003A065A

>>>> Mouse <<<<

Position: 1665, 374

Cursor ID: 5

Color: 0xFFFFFF

>>>> StatusBar <<<<

>>>> Visible Text <<<<

Type/Paste citation here

See

>>>> Hidden Text <<<<

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try this:

WinWait("Is it on BAILII?", "Type/Paste citation here")
ControlSetText("Is it on BAILII?", "Type/Paste citation here", "[CLASS:Edit; INSTANCE:1]", "[2010] EWMC 222 (FPC)")

or

WinWait("Is it on BAILII?", "Type/Paste citation here")
ControlSend("Is it on BAILII?", "Type/Paste citation here", "[CLASS:Edit; INSTANCE:1]", "[2010] EWMC 222 (FPC)")

If its not working you could try play with WinTitleMatchMode, for example you could put at the begining of the script this line:

Opt("WinTitleMatchMode", 2)
Edited by Makaule

Share this post


Link to post
Share on other sites

Here is my simple working ControlSend line

Func _Send($text)
$hwnd = WinGetHandle("SomeWindowName")
$window = "SomeWindowName"
    ControlSend($window, "", $hwnd, $text)
EndFunc

ofc it is working

and i preffer to use _MouseClickPlus by Insolence, not ControlClick :blink:


This world is crazy

Share this post


Link to post
Share on other sites

Thanks all - good ideas but I found my main problem was that there was a space before my window title.. sigh

Now instead of filling in the window with [2010] EWMC 222 (FPC) I get [2010] EwMC 222 (FPc) why would that be?

ControlSend(" Is it on BAILII?", "", "Edit1", "[2010] EWMC 222 (FPC)")

Share this post


Link to post
Share on other sites

$hwnd = WinGetHandle("Is it on BAILII?")
$window = "Is it on BAILII?"
    ControlSend($window, "", $hwnd, "Your text")

btw you have sensless SPACE BAR in window name (" <SPACE>Is Its... bablblalbla

mY CODE should work, try IT


This world is crazy

Share this post


Link to post
Share on other sites

$hwnd = WinGetHandle("Is it on BAILII?")
$window = "Is it on BAILII?"
    ControlSend($window, "", $hwnd, "Your text")

btw you have sensless SPACE BAR in window name (" <SPACE>Is Its... bablblalbla

mY CODE should work, try IT

This works (added the space at the start of the title):

ControlSetText(" Is it on BAILII?", "", "Edit1","",1 )
ControlSend(" Is it on BAILII?", "", "Edit1", "[2010] EWMC 22 (FPC)")
Sleep (1000)
ControlClick(" Is it on BAILII?", "", "[CLASS:Button; TEXT:See; INSTANCE:1]")

but this doesn't:

$hwnd = WinGetHandle(" Is it on BAILII?")
$window = " Is it on BAILII?"
ControlSend($window, "", $hwnd, "[2010] EWMC 22 (FPC)")

can't see why not & I'd like to use your function so I'll keep at it.

Thanks,

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

because you are trying to insert text in $hwnd - inside GUI, but not EditBox. Normaly if i use $hwnd, i use it like that:

$hWnd = WinGetHandle("GUI Name")
ControlSend($hWnd, "Some text inside gui", "[Some Place to enter]", "[2010] EWMC 22 (FPC)")

Your misstake is that you try to insert text to GUI ($hwnd in wrong place), not to editbox.

Edited by Makaule

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