Jump to content

Need to copy link from IE object to Input


Recommended Posts

Hi all.

Here is a sample, IE object with link and Input.

I need to get link text in Input, when clicking link. But i have no any ideas...

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <IE.au3>

Opt("GUIOnEventMode", 1)

$text=""

$Form = GUICreate("Form1", 320, 285, 193, 115)

GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")

$Input = GUICtrlCreateInput("", 16, 248, 249, 21)

GUISetState(@SW_SHOW)

$oIE = _IECreateEmbedded()

$Output = GUICtrlCreateObj($oIE, 10,10, 300, 200)

$sHTML='<a href="http://">Google</a>'

_IENavigate($oIE, "about:blank")

_IEDocWriteHTML($oIE, $sHTML)

;Here $text should get data "Google" somehow, but only after click.

GUICtrlSetData($Input,$text)

While 1

Sleep(100)

WEnd

Func Form1Close()

Exit

EndFunc

Edited by Axel82
Link to comment
Share on other sites

No, I have in view of another.

There is a form with Button and Input. I clicked Button, and function "Buttonclick" read text of the button and put it in Input.

$temp=GuiCtrlRead($button)

GuiCtrlSetData($input,$temp)

I need the same, but for a link.

By pressing the link, its text should appear in Input.

post-36232-12682262375557_thumb.jpg

Edited by Axel82
Link to comment
Share on other sites

You'll need to use ObjEvent. You'll have trouble however because AutoIt does not handle events synchronously and seeing that the link causes the page to navigate, the link will no longer be valid by the time you try to access its properties in AutoIt.

You could potentially parse through all of the links on the page and note the link text after the initial load and then you could know the link text based on the link that triggers the onclick event because you already knew it rather than trying to read it after activation.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...