Jump to content

_IETagNameGetCollection won't show tags, but shows the tag count


Recommended Posts

#include

;~ $SiteLink = InputBox("Link", "Paste link to download images from", "http://www.stanceworks.com")
;~ Local $oIE = _IECreate($SiteLink)

Local $oIE = _IE_Example("basic")

Local $sTags = _IETagNameGetCollection($oIE, "img", 0)
$ImageCount = @extended

;~ For $sTags In $sTags
;~ MsgBox("","", "Tag: " & $sTags)
;~ Next

MsgBox("","",$ImageCount)
MsgBox("","",$sTags)

Im trying to make a script that will automaticly download all pictures in from a webpage, except the ones i tell it not to.

But im havving issues.

I im trying to figure out a way to get the <img> tags, and i think ive done that, but i can't figure out why the msgbox is just blank.

The example suggest i should use $sTags.Name or something like that.

But i don't know what "that" is called, so i can't google for it.

Any suggestions on what to use $sTags.Here ?

Or any suggestion on how to easy get all <img> tags listed on a page ?

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

Thank you!

I suck at browsing the msdn thing.

New issue!

How can i make it browse through all the different <img> tags ?

Cause the uses the For..In Loop

But that just shows up empty for me.

For $oInput In $oInputs
    MsgBox(0, "Form Input Type", "Form: " & $oInput.form.name & " Type: " & $oInput.type)
Next

#include 

;~ $SiteLink = InputBox("Link", "Paste link to download images from", "http://www.stanceworks.com")
$SiteLink = InputBox("Link", "Paste link to download images from", "http://www.stanceworks.com/2012/06/the-quest-to-break-10-johans-turbo-e30-m3/")
Local $oIE = _IECreate($SiteLink)

Local $sTags = _IETagNameGetCollection($oIE, "img", 0)
$ImageCount = @extended

MsgBox("","",$ImageCount)
MsgBox("","",$sTags.src)

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

#include <IE.au3>
;~ $SiteLink = InputBox("Link", "Paste link to download images from", "http://www.stanceworks.com")
$SiteLink = InputBox("Link", "Paste link to download images from", "http://www.stanceworks.com/2012/06/the-quest-to-break-10-johans-turbo-e30-m3/")
Local $oIE = _IECreate($SiteLink)
Local $sTags = _IETagNameGetCollection($oIE, "img")
$ImageCount = @extended
MsgBox("","",$ImageCount)
For $tag In $sTags
MsgBox("","",$tag.src)
Next

Link to comment
Share on other sites

Wait, what?

How the...

That works...

Thanks........

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

You remove the "0" as the third parameter of _IETagNameGetCollection() function. This makes it so that it returns the entire collection rather than a single indexed instance.

"For $tag In $sTags" iterates through the entire collection with $tag representing a single tag in any given iteration. $tag is declared by the For loop itself.

For greater flexibility, you could replace that For loop with something like this (make sure you declare $tag yourself, if necessary):

For $i = 0 To $ImageCount - 1
$tag = _IETagNameGetCollection($oIE, "img", $i)
;Here you can choose to skip the numbers you don't want...
;This will skip #7, which is the eighth in the collection
If Not $i = 7 Then MsgBox("","",$tag.src)
Next

I point this out because previously you had mentioned you want to get pictures except those you tell script to exclude, so this is one way you can implement that exclusion, though it's probably easier to do it after you have all the src URLs in an array or something then process it.

Edited by MrMitchell
Link to comment
Share on other sites

"For $tag In $sTags" iterates through the entire collection with $tag representing a single tag in any given iteration. $tag is declared by the For loop itself.

That clears it up, i was having trouble understanding where the $tag came from.

I point this out because previously you had mentioned you want to get pictures except those you tell script to exclude, so this is one way you can implement that exclusion, though it's probably easier to do it after you have all the src URLs in an array or something then process it.

My plan is to get all links to images in an array, then compare the Link-array to an array of blacklisted images.

Theese images would be saved in an external file, because then it would be easy to make a new blacklist if i find a new page that supports the same technique.

Also your script is based upon numbers, if suddenly the page adds an extra advertisment image then the whole thing would have to be adjusted.

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

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