Jump to content

Flash To Go


smstroble
 Share

Recommended Posts

Its quick and dirty for the moment I will clean it up later. Anyway the idea is to be able to download Flash videos (no not youtube etc.) and Flash games and use them when you don't have internet access, slow internet connection, or want to avoid detection by the network admin/avoid blocks :) . I have tested this program with addicting games and armor games, and it should work for any website with html or java coded flash objects. Put in the page url the game is it and the script will download the .swf game of movie to the script dir, it also has a modified copy lod3n's Flashy script (http://www.autoitscript.com/forum/index.php?showtopic=32395) that can be used by leaving the input box blank.

#include <GUIConstants.au3>
#include <ie.au3>
#include <array.au3>

$oIE = 0
$gui = 0 ;so AU3Check dosent complain at me...


$flashfile = _ArrayToString($cmdline," ",1)
If StringLen($flashfile) = 0 Then
    $PAGE = InputBox("WebAdress", "URL=" & @CRLF & "(Leave blank to load a .swf file")
    Dim $downloaded[100]
    $downloaded[0] = 0
    If StringLen($PAGE) = 0 Then
        FlashyMain()
    Else
        InetGet($PAGE, @ScriptDir & "\temp.html")
        $html = FileOpen(@ScriptDir & "\temp.html", 0)
    EndIf

    While 1
        $line = FileReadLine($html)
        If @error Then 
            FileClose($html)
            FileDelete(@ScriptDir & "\temp.html")
            MsgBox(0, "Downloaded", "Downloaded " & $downloaded[0] & " .swf Files")
            Exit
        EndIf
        $delimit = "'"
        $delimit &= '"' ;Yeah... putting both of these ' and " on the same line was giving me a headach
        $split = Stringsplit($line, $delimit)
        If Not @error Then
            For $i = 1 to $split[0]
                If StringRight($split[$i], 3) = "swf" Then
                    $match = $split[$i]
                    $split2 = Stringsplit($line, ",)")
                    match()
                EndIf
            Next
        EndIf
    WEnd
Else
    FlashyMain()
EndIf

Func FlashyMain()
    $flashfile = FileOpenDialog("Open", @ScriptDir, "Flash(*.swf)")
    If @error Then
        Exit
    EndIf
    Global $gui = GUICreate("Flashy"&$flashfile, 700, 600, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS),$WS_EX_ACCEPTFILES)
    Global $title = "Flashy"&$flashfile
    Global $oIE = _IECreateEmbedded ( )
    Global $browser = GUICtrlCreateObj($oIE, 3, 3, 700, 600)
    GUICtrlSetState (-1, $GUI_DROPACCEPTED)
    GUICtrlSetResizing(-1,$GUI_DOCKBORDERS)


    _IENavigate ($oIE, 'about:blank')
    Global $oDoc = _IEDocGetObj ($oIE)
    $oDoc.body.style.overflow = "auto"
    GUISetState(@SW_SHOW)

    Global $sHTML = '<embed id=flashy src="" '
    $sHTML &= 'quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" '
    $sHTML &= 'type="application/x-shockwave-flash" '
    $sHTML &= 'width="100%" height="100%"></embed>'
    _IEBodyWriteHTML ($oIE, $sHTML)

    loadswf($flashfile)

    While 1
        $Msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            case $msg = $GUI_EVENT_DROPPED
                loadswf(@GUI_DRAGFILE)
        EndSelect
    WEnd
EndFunc

func loadswf($filename)
    if stringlen($filename) = 0 then
        msgbox(16,"Flashy","No flash file specified. Associate SWFs with Flashy, or drop one onto the blank window")
        Return
    EndIf
    if stringright($filename,4) <> ".swf" then
        msgbox(16,"Flashy - Error","Dude, that's not a SWF.")
        Return
    EndIf
    
    $flash = _IEGetObjByName ($oIE, "flashy")
    $flash.Movie = $filename
    winsettitle($gui,"","Flashy - "&$filename)
    $title = "Flashy - "&$filename
EndFunc

Func match()
    $split3 = StringSplit($match, "/")
    $size = InetGetSize($match)
    If $size > 200000 Then
        For $q = 1 to $downloaded[0]
            If $match = $downloaded[$q] Then
                Return
            EndIf
        Next
        InetGet($match, @ScriptDir & "\" & $split3[$split3[0]])
        $downloaded[0] += 1
        $downloaded[$downloaded[0]] = $match
    EndIf
EndFunc

EDIT: Minor... Major bug fix lol

Edited by smstroble

MUHAHAHAHAHA

Link to comment
Share on other sites

A nice idea, however some people use Firefox extensions to do this, like DownThemAll or FlashGot.

Ah well, more scripting experience i guess lol.

EDIT: when i get this setup the way i want it it will be more than just downloading the .swf, biggest feature i want to try to get to work is makeing it so that you saved games will automatically get stored in the script dir and put back into the seemingly randomly assigned folders that flash makes for game data. (i know where the data is stored but the folder names seem to be random i dont know how im going to work around that yet. i have played/fought with it with Ngame)

Hmm, it seems that fasco-csc uses relative links to thier files rather than exact, i think i can make that work, ill include a fix for that when i get the GUI and what not the way i want it. Edited by smstroble

MUHAHAHAHAHA

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