sirkerry Posted October 5, 2009 Posted October 5, 2009 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
sirkerry Posted October 5, 2009 Author Posted October 5, 2009 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?
dantay9 Posted October 5, 2009 Posted October 5, 2009 _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])
sirkerry Posted October 6, 2009 Author Posted October 6, 2009 _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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now