Jump to content

Script errors...


Didonet
 Share

Recommended Posts

Hi, I'm writing a script that download avatars from last.fm of music groups or singers and.. thats my code... I get some orange errors in the SCiTE editor...

Func IENavigate($p, $artist)
    _IENavigate($oIE, "http://last.fm/music/" & StringReplace($artist, " ", "+") & "/+images?page=" & $p)
    $sHTML = _IEBodyReadHTML($oIE)
EndFunc   ;==>IENavigate

Func SaveImgs($artist)
    $sImgDir = $avatarsDir & $artist & "\"
    $oIMGs = _IEImgGetCollection($oIE)
    For $oImg In $oIMGs
        If StringInStr($oImg.src, '/serve/160/') Then
            $sImgUrl = $oImg.src
            $sImgFileName = $oImg.nameProp
            If InetGet($sImgUrl, $sImgDir & $sImgFileName) Then
                If $progress_bar = 100 Then $progress_bar = 0
                $saved += 1
                $progress_bar += 1
                ProgressSet($progress_bar, "[ " & $saved & " ] images saved... " & @CRLF & "[ " & $page & " ] page")
                Sleep(200)
            EndIf
        EndIf
    Next
EndFunc   ;==>SaveImgs

Func DownloadAvatars($artist, $sImgDir)
    $saved = False
    If Not FileExists($sImgDir) Then
        DirCreate($sImgDir)
    EndIf

    ProgressOn("last.fm avatar downloader", $artist & '...', "connecting...", -1, -1, 16 + 2)

    $oIE = _IECreate("about:blank", 0, 0, 1)
    IENavigate($page, $artist)
    Sleep(5000)
    SaveImgs($artist)

    While StringInStr($sHTML, 'nextlink')
        $page += 1
        IENavigate($page, $artist)
        SaveImgs($artist)
    WEnd

    _IEQuit($oIE)

    If $saved = False Then
        DirRemove($sImgDir)
        ProgressSet(0, 'No images found...')
        Sleep(1000)
        ProgressOff()
    Else
        ProgressSet(100, 'Downloading pictures for "' & $artist & '"...', "downloaded...")
        Sleep(1000)
        ProgressOff()
    EndIf

EndFunc   ;==>DownloadAvatars
Link to comment
Share on other sites

now it shows one error... o_O

strange... before a few minutes it shows more than 4-5 errors... like to use _IEErrorHandlerRegister() and... problems with attaching, problem with IEIsObj (or something like that) and more...

Now its that:

--> IE.au3 V2.3-1 Warning from function _IECreate (Foreground Window Unlock Failed!)

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