Jump to content

_IE.au3 viewing the full 'a href' with target=


 Share

Recommended Posts

Not sure if this is the correct terminlogy but I am trying to view the full HTML code on all links on a page that have the following in their code.

target="_blank"

So really, I think I just need the "method" (is that right?) In the example from the help file it uses the following code. I am guessing I need something other than the "$oLink.href" to view the part of the code that has target? In this example there is no link with target= in the code, but the webpage I am using it for, I cannot post in a public forum. I was thinking to use "$oLink.target" but that doesn't seem to produce any result other than 0.

#include <IE.au3>
$oIE = _IE_Example ("basic")
$oLinks = _IELinkGetCollection ($oIE)
$iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
    MsgBox(0, "Link Info", $oLink.href)
Next

Thanks in Advance.

Link to comment
Share on other sites

Your guess is correct -- the property you want is .target

You can verify this by looking at the MSDN docs... InternetExploerer -> Document -> Link -- see my sig.

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

Your guess is correct -- the property you want is .target

You can verify this by looking at the MSDN docs... InternetExploerer -> Document -> Link -- see my sig.

Dale

Thanks for the link that will be helpful in the future.

I think this is what I am shooting for, based off some help you gave in the past. But I don't quite understand the StringLen part, it seems that this would just return a number, and that would always be true?

****EDIT****

Or is that the point, that it is always true? So change every link to be _top?

************

$sUrl = "http://www.htmlcodetutorial.com/linking/_A_TARGET_95y98y108y97y110y107y.html"
$oIE = _IECreate ($sUrl,1)
$oLinks = _IELinkGetCollection ($oIE)

For $oLink In $oLinks
   If StringLen(String($oLink.target)) Then
        $oLink.target = "_top"
    EndIf
Next
Edited by litlmike
Link to comment
Share on other sites

If there is no target= property on the link then StringLen will be 0 and the If will evaluate to False and skip setting the target to _top. If the target= is set to anything, then the StringLen will be a positive integer and the If will evaluate to true (any non-zero value evaluates to True) and it will force target="_top"

Make sense?

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

If there is no target= property on the link then StringLen will be 0 and the If will evaluate to False and skip setting the target to _top. If the target= is set to anything, then the StringLen will be a positive integer and the If will evaluate to true (any non-zero value evaluates to True) and it will force target="_top"

Make sense?

Dale

Yes it does, you are a very clever man.

Thanks for your assistance.

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...