Jump to content
Sign in to follow this  
sirkerry

Getting the src from an IE <embed> tag

Recommended Posts

sirkerry

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

Share this post


Link to post
Share on other sites
sirkerry

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?

Share this post


Link to post
Share on other sites
dantay9

_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])

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites
sirkerry

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

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  

×