Jump to content
Sign in to follow this  
HeidiR

ControlFocus return = 1 but control does NOT have focus

Recommended Posts

HeidiR

In the script below, I am opening an html file in an enbedded IE object (UDF) and selecting all text in the object and copyiing to the clipboard.

Unfortunately, the select all and copy does not work because the ControlFocus function (line #22 below) is failing. Actually, the ControlFocus return code = 1, which indicates success, but the control does NOT have focus. The ControlGetFocus (line #23 below) shows button1 having the focus.

What am I missing???

#include <ie.au3>

Opt("GuiOnEventMode", 1)

Global $oIE, $Button1

GUICreate("Embedded IE", 600, 400)

GUISetOnEvent(-3, "quit")

$oIE = _IECreateEmbedded()

GUICtrlCreateObj($oIE, 10, 10, 580, 340)

$Button1 = GUICtrlCreateButton("Open", 125, 360, 100, 30)

GUICtrlSetOnEvent(-1, "go")

_IENavigate($oIE, "about:blank", 0)

GUISetState()

While 1

Sleep(1000)

WEnd

Func go()

_IENavigate($oIE, "label.html", 0)

msgbox(0,"ControlFocus", ControlFocus ("Embedded IE", "", $oIE))

msgbox(0,"ControlGetFocus", ControlGetFocus ("Embedded IE"))

send("^a") ;Select all

send("^c") ;Copy

EndFunc

Func quit()

Exit

EndFunc


HeidiRFind free applications, code examples and more on my site at:http://heidisdownloads.com/

Share this post


Link to post
Share on other sites
HeidiR

Thanks for the information. ClipPut(_IEBodyReadText ($oIE)) worked perfectly!!!


HeidiRFind free applications, code examples and more on my site at:http://heidisdownloads.com/

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.