Jump to content

Downloading specific image help...


Recommended Posts

This forum was of no help so far so Ill give it one last chance....

How can I download a specific image from a webpage. I have a code that will show the number of images present on the webpage and all of their .scr However, how do i go about downloading an indexed image. I tried creating an array but that was of no luck.

$oImgs = _IEImgGetCollection($oIE)
$iNumImg = @extended
MsgBox(0, "Img Info", "There are " & $iNumImg & " images on the page")
For $oImg In $oImgs
    MsgBox(0, "Img Info " , "src=" & $oImg.src)
InetGet ("$oImg", @DesktopDir)
Next
Link to comment
Share on other sites

Would you mind sending me the website its located at and the image file you are trying to get?

If you are un-willing to do that then here is a snippet of my code I currently use to take the images from Weather.com. If its confusing then let me know.

Func _GetOverViewImages()
$Url = 'http://www.weather.com/weather/today/' & $City[1] & '+' & $State[1] & '+' & $Zipcode
    Global $sSource = BinaryToString(InetRead($Url,1))
    $Image1 = StringRegExp($sSource, "(?i)<imgssrc=.+(http.+.png).*column 1.*-->", 1)
    $Image2 = StringRegExp($sSource, "(?i)<imgssrc=.+(http.+.png).*column 2.*-->", 1)
    $Image3 = StringRegExp($sSource, "(?i)<imgssrc=.+(http.+.png).*column 3.*-->", 1)
    $Image4 = StringRegExp($sSource, "(?i)<imgssrc=.+(http.+.png).*column 4.*-->", 1)
    For $i = 1 To 4
        If $i = 1 Then
            $OverViewImage[1] = $Image1[0]
        ElseIf $i = 2 Then
            $OverViewImage[2] = $Image2[0]
        ElseIf $i = 3 Then
            $OverViewImage[3] = $Image3[0]
        ElseIf $i = 4 Then
            $OverViewImage[4] = $Image4[0]
        EndIf
    Next
    For $i = 1 To 4
        If $i = 1 Then
            FileDelete(@ScriptDir & "ImagesImage1.png")
            $RightNowImage = InetGet($OverViewImage[1], @ScriptDir & "ImagesImage1.png",1)
        EndIf
        If $i = 2 Then
            FileDelete(@ScriptDir & "ImagesImage2.png")
            $TodayImage = InetGet($OverViewImage[2], @ScriptDir & "ImagesImage2.png",1)
        EndIf
        If $i = 3 Then
            FileDelete(@ScriptDir & "ImagesImage3.png")
            $TonightImage = InetGet($OverViewImage[3], @ScriptDir & "ImagesImage3.png",1)
        EndIf
        If $i = 4 Then
            FileDelete(@ScriptDir & "ImagesImage4.png")
            $TomorrowImage = InetGet($OverViewImage[4], @ScriptDir & "ImagesImage4.png",1)
        EndIf
    Next
EndFunc

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

Ok im am using a random video on youtube. When you comment too many times you get a captcha image. I am trying to download that. Here is my full code. Not sure if its really legal in this forum that is why I did not include it.

#include<IE.au3>
;_IEErrorHandlerRegister()
;_IELoadWaitTimeout(5000)
$oIE=_IECreate("http://www.youtube.com/watch?v=JjmeSwPig_8",0,1,1)
_IELoadWait($oIE)
$oForm=_IEGetObjByName($oIE,"comment")
_IEAction($oForm, "focus")
;_IEFormSubmit($oForm)
;$oSubmit=_IEGetObjByName($oIE,"add_comment_button")
_IEFormElementSetValue($oForm,"Thanks")
$oButtons = _IETagNameGetCollection ($oIE, "button")
For $oButton In $oButtons
    If $oButton.type = "submit" Then _IEAction ($oButton, "click")
Next
$oImgs = _IEImgGetCollection($oIE)
$iNumImg = @extended
MsgBox(0, "Img Info", "There are " & $iNumImg & " images on the page")
For $oImg In $oImgs
    MsgBox(0, "Img Info " , "src=" & $oImg.src)
InetGet ("$oImg", @DesktopDir)
Next
Link to comment
Share on other sites

  • Moderators

psychoblast,

Not sure if its really legal in this forum

It is not - do not post asking about CAPTCHAs on this forum again. :oops:

M23

Edit:

This forum was of no help so far so Ill give it one last chance

And if this really was the last chance, we will not miss you! :bye: Edited by Melba23
Noticed the first line of the first post

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...