Jump to content

Listing *.mp3 files in a GUICtrlCreateList


Recommended Posts

There are 10 .mp3's on an IE page, and i want it to list them on my GUICtrlCreateList. It is beginning to get extremely annoying.. so can someone help me out?

The "*.mp3" is not on the page, but it is the file type..

(Id like the file names listed, instead of the words that link me to the file)

Edited by houseonfire
Link to comment
Share on other sites

I read this a few times (I had to restart my system a few times for a project, and this page was left in a browser tab) but it still doesn't make a lot of sense.

In the absense of any clue on your part, it might be an idea to post the source of the page in question, so we can see the actual links you are trying to grab. And perhaps the AutoIt source, so we can see what you are trying to do.

In the absense of both those things, just extract the href from inside the anchors <a href="<i am the file link you want>">words you don't want</a>.

;o)

(or

nothing is foolproof to the sufficiently talented fool..

Link to comment
Share on other sites

Perhaps this will help:

#include <GUIConstants.au3>
#include <IE.au3>
#include <Misc.au3>
;Create hidden explorer:
$oIE=_IECreate("http://www.aetninternational.com/content/music/mp3/Coldplay/X&Y/",0,0)

;Get links list:
$oLinks = _IELinkGetCollection ($oIE)
$iNumLinks = @extended

;Create Gui:
$GUi=GUICreate("Mp3 Downloader", 525, 450, 227, 72)
 GUICtrlCreateGroup(" LInks to Mp3's Found ", 8, 8, 513, 313)
$List =  GUICtrlCreateList("", 16, 24, 497, 279, BitOR($LBS_SORT,$LBS_DISABLENOSCROLL,$LBS_STANDARD,$WS_HSCROLL,$WS_VSCROLL,$WS_BORDER))
 GUICtrlCreateGroup(" Save in ", 128, 328, 265, 65)
$Path = GUICtrlCreateInput(@MyDocumentsDir, 152, 352, 217, 21)
$Download = GUICtrlCreateButton("Download selected", 208, 400, 121, 33, $BS_DEFPUSHBUTTON)

;Put links in list:
For $oLink In $oLinks
    GUICtrlSetData($List,$oLink.href)
Next

;Show GUI
GUISetState(@SW_SHOW)

;Loop
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
            ;Close hidden IE window and quit
            _IEQuit($oIE)
            ExitLoop
        Case $Download
            $Link2Down=GUICtrlRead($List)
            ;Check if a link has been highlighted
            If $Link2Down="" Then 
                MsgBox(0,"oops","Please select one!")
            Else
                $OutPath=GUICtrlRead($Path)
                $Name=InputBox("","Please insert the name for the Mp3. No need for the extension",""," M")
                If Not @error Then
                    $Size=InetGetSize($Link2Down)
                    InetGet($Link2Down,$OutPath&"\"&$Name&".mp3",0,1)
                    ProgressOn("Downloading","Downloading Mp3...","",-1,-1,18);Sets the progress
                    GUISetState(@SW_HIDE,$GUi);Hides GUI
                    ;Loop around and show progress till it finishes
                    While @InetGetActive
                        Sleep(50)
                        $Percent=Int((@InetGetBytesRead*100)/$Size)
                        ProgressSet( $Percent,$Percent & "% Downloaded...")
                    WEnd
                    ProgressSet(100 , "Done", "Complete")
                    sleep(500)
                    ProgressOff()
                    MsgBox(64,"Downloaded","Mp3 downloaded successfully!")
                    GUISetState(@SW_SHOW,$GUi);Shows GUi again
                EndIf
            EndIf
    EndSwitch
WEnd

And you can use corz's idea too. Should be hard to do :)

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