Jump to content

Getting the src from an IE <embed> tag


Recommended Posts

Is there any better way to get the src from an <embed> tag then what I have below?

$oInputs = _IETagNameGetCollection ($oIE, "embed")
For $oInput In $oInputs
    MsgBox(0, "Element Info", "Tagname: " & $oInput.tagname & @CR & "contents: " & $oInput.outerHTML)
Next
Link to comment
Share on other sites

What I'm trying to do is extract the src portion of the <embed> tag so I can dowload the specified file:

$oInputs = _IETagNameGetCollection ($oIE, "embed")
For $oInput In $oInputs
        MsgBox(0, "Element Info", "Tagname: " & $oInput.tagname & @CR & "contents: " & $oInput.outerHTML)
        $oFileDL = _StringBetween(String($oInput.outerHTML), '<embed src="', '#toolbar=1"')
    MsgBox(0, "Element Info", "Tagname: " & $oInput.tagname & @CR & "contents: " & $oFileDL)
Next

This is the result being returned by oInput.outerHTML:

<embed src="/appimg/DOCNICIBXXC2290900053284731600000222257671.pdf#toolbar=1" width="100%" height="100%">

The _StringBetween function however is just returning a 0. So what am I doing wrong now?

Link to comment
Share on other sites

_StringBetween returns an array, not a string. Something like this:

#include <String.au3>

$String = '<embed src="/appimg/DOCNICIBXXC2290900053284731600000222257671.pdf#toolbar=1" width="100%" height="100%">'

$Between = _StringBetween($String, "<embed src=", "#toolbar=1")
MsgBox(0, '', $Between[0])
Link to comment
Share on other sites

_StringBetween returns an array, not a string. Something like this:

#include <String.au3>

$String = '<embed src="/appimg/DOCNICIBXXC2290900053284731600000222257671.pdf#toolbar=1" width="100%" height="100%">'

$Between = _StringBetween($String, "<embed src=", "#toolbar=1")
MsgBox(0, '', $Between[0])

Didn't work. Ended up using using StringRight & StringLeft to get the URL.
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...