Jump to content

Can someone make this better?


Bert
 Share

Recommended Posts

I played around with a script Gary told me about last week to play flash files. Works fine. I wanted to have it so I could select the file I wanted to play from a list, then have the flash player run it. When I was done, it would go back to let me select another one. I tried using the one that someone else did, but it wouldn't work on local flash files. I keep them on my thumb drive for there are times when I don't have internet access, but I want to play a game.

To explain on how this works: You will need to have a flash file in the same directory as the script. Run flashloader. It will search the directory and list all the flash files it finds. Pick the one you want, and click play. Player.au3 will run the flash file (after compiled to a exe). When you close player, it will reopen flashloader, allowing you to pick something else.

What I like to see if someone could put this all in one script. I tried, but the player would not work.

Code:

flashloader.au3:

#Include <File.au3>
#include <GuiConstants.au3>
#include <GuiList.au3>
#include <Array.au3>
GuiCreate("Flash Player by Volly", 250, 548,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$FileList=_FileListToArray(@ScriptDir, "*.swf", 1)
$atr= _ArrayTrim($FileList,4,1,1)
$st= _ArrayToString($atr,"|",1)
$Edit_1 = GuiCtrlCreatelist("", 20, 30, 170, 450)
GUICtrlSetData($Edit_1,$st)
$Button_2 = GuiCtrlCreateButton("Play Game", 20, 490, 80, 30)
$Button_3 = GuiCtrlCreateButton("Exit", 110, 490, 80, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    
    Case $msg = $Button_2
        $read = GUICtrlRead($Edit_1)
        IniWrite(@ScriptDir & "\game.ini", "play", "game", $read &".swf")
        IniWrite(@ScriptDir & "\game.ini", "play", "gamename", $read )
        GUISetState(@SW_HIDE)
        Runwait(@ScriptDir & "\player.exe")
        GUISetState(@SW_SHOW)
    
    case $msg = $Button_3
        exit
    Case Else
        ;;;
    EndSelect
WEnd
ExitoÝ÷ ÚZÉêÚ»v®¶­sb6æ6ÇVFRfÇC´uT6öç7FçG2æS2fwC°¢6æ6ÇVFRfÇC¶RæS2fwC°¢b33c·FFÆVæÖRÒæ&VB67&DF"fײgV÷C²b3#¶vÖRæægV÷C²ÂgV÷C·ÆgV÷C²ÂgV÷C¶vÖVæÖRgV÷C²ÂgV÷C²gV÷C²¢b33c´f÷&ÓÒuT7&VFRb33c·FFÆVæÖRÂSCÂS3Â#Â#"Â&"b33cµu5ôÔäÔ¤T$õÂb33cµu5õ4¤T$õÂb33cµu5õD4´e$ÔRÂb33cµu5õ54ÔTåRÂb33cµu5ô4DôâÂb33cµu5õõUtäDõrÂb33cµu5ôu$õUÂb33cµu5ô$õ$DU"Âb33cµu5ô4Ä4$Ääu2¢b33c´ö&¢ÒôT7&VFTVÖ&VFFVB¢b33c¶'&÷w6W"ÒuT7G&Ä7&VFTö&¢b33c´ö&¢ÂÂÂS#BÂSb¤uT7G&Å6WE&W6¦ærÓÂb33c´uTôDô4´$õ$DU%2 ¥ôTæfvFRb33c´ö&¢Âb33¶&÷WC¦&Ææ²b33²¢b33c¶ôFö2ÒôTFö4vWDö&¢b33c´ö&¢¢b33c¶ôFö2æ&öGç7GÆRæ÷fW&fÆ÷rÒgV÷C¶WFògV÷C°¤uT6WE7FFR5uõ4õr ¢b33c¶fÆ6Òæ&VBgV÷C¶vÖRæægV÷C²ÂgV÷C·ÆgV÷C²ÂgV÷C¶vÖRgV÷C²ÂgV÷C²gV÷C²¢b33c¶fÆ6Ò67&DF"fײgV÷C²b3#²gV÷C²fײb33c¶fÆ6 ¢b33c·4DÔÂÒb33²fÇC¶VÖ&VBCÖfÆ67&3ÒgV÷C²b33²fײb33c¶fÆ6fײb33²gV÷C²b33°¢b33c·4DÔÂf׳Òb33·VÆGÒgV÷C¶vgV÷C²ÇVvç7vSÒgV÷C¶GG¢ò÷wwræÖ7&öÖVFæ6öÒövòövWFfÆ6ÆW"gV÷C²b33°¢b33c·4DÔÂf׳Òb33·GSÒgV÷C¶Æ6Föâ÷×6ö6·vfRÖfÆ6gV÷C²b33°¢b33c·4DÔÂf׳Òb33·vGFÒgV÷C³RgV÷C²VvCÒgV÷C³RgV÷C²fwC²fÇC²öVÖ&VBfwC²b33°¥ôT&öGw&FTDÔÂb33c´ö&¢Âb33c·4DÔ §6ÆVW#¢b33c´ö&£ÒôTvWDö&¤'æÖRb33c´ö&¢ÂgV÷C¶fÆ6gV÷C² ¥vÆR¢b33c¶ä×6rÒuTvWD×6r¢7vF6b33c¶ä×6p¢66Rb33c´uTôUdTåEô4Äõ4P¢W@ ¢VæE7vF6¥tVæ@
Link to comment
Share on other sites

  • Moderators

Do you know how to get the size/play length? (I don't know of those files is why I'm asking)... If you do, then it's a walk in the park.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I just got it working in one script. It still uses a ini, but works. I need to make it use a varaible instead.

@smoke: not sure on how to answer your question. The files sizes to the window, so in some games there is a blank area to the sides. No big deal to me, but I was thinking of having the viewer size itself to the monitor.

#Include <File.au3>
#include <GuiConstants.au3>
#include <GuiList.au3>
#include <Array.au3>
#include <ie.au3>
GuiCreate("Flash Player by Volly", 250, 548,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$FileList=_FileListToArray(@ScriptDir, "*.swf", 1)
$atr= _ArrayTrim($FileList,4,1,1)
$st= _ArrayToString($atr,"|",1)
$Edit_1 = GuiCtrlCreatelist("", 20, 30, 170, 450)
GUICtrlSetData($Edit_1,$st)
$Button_2 = GuiCtrlCreateButton("Play Game", 20, 490, 80, 30)
$Button_3 = GuiCtrlCreateButton("Exit", 110, 490, 80, 30)

GuiSetState()
While 1
    
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    
    Case $msg = $Button_2
        $read = GUICtrlRead($Edit_1)
        IniWrite(@ScriptDir & "\game.ini", "play", "game", $read &".swf")
        IniWrite(@ScriptDir & "\game.ini", "play", "gamename", $read )
        GUISetState(@SW_HIDE)
        _viewer()
        GUISetState(@SW_SHOW)
    
    case $msg = $Button_3
        exit
    Case Else
        ;;;
    EndSelect
WEnd
Exit

func _viewer()
    $titlename = IniRead(@ScriptDir & "\game.ini", "play", "gamename", "" )
    $Form1 = GUICreate($titlename, 540, 538, 219, 122, BitOR($WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
    $Obj = _IECreateEmbedded ( )
    $browser = GUICtrlCreateObj($Obj, 8, 8, 524, 516)
    GUICtrlSetResizing(-1,$GUI_DOCKBORDERS)
    _IENavigate ($Obj, 'about:blank')
    $oDoc = _IEDocGetObj ($Obj)
    $oDoc.body.style.overflow = "auto"
    GUISetState(@SW_SHOW)
    $flash = IniRead("game.ini", "play","game", "")
    $flash1 = @ScriptDir &"\"& $flash      
    $sHTML = '<embed id=flashy src="'&$flash1&'" '
    $sHTML &= 'quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" '
    $sHTML &= 'type="application/x-shockwave-flash" '
    $sHTML &= 'width="100%" height="100%"></embed>'
    _IEBodyWriteHTML ($Obj, $sHTML)
    sleep(2000)
    $Obj1 = _IEGetObjByName ($Obj, "flashy")
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($Form1)
            ExitLoop    
        EndSwitch
    WEnd
EndFunc
Edited by vollyman
Link to comment
Share on other sites

Ok, I got it working pretty well. I'll post it to the scripts and scraps section in a bit, but I wonder if could be tweaked any better. Thoughts?

#Include <File.au3>
#include <GuiConstants.au3>
#include <GuiList.au3>
#include <Array.au3>
#include <ie.au3>
Dim $selection, $Form1
Dim $selection2
GUICreate("Flash Player by Volly", 220, 548, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$FileList = _FileListToArray (@ScriptDir, "*.swf", 1)
$atr = _ArrayTrim($FileList, 4, 1, 1)
$st = _ArrayToString($atr, "|", 1)
$Edit_1 = GUICtrlCreateList("", 20, 30, 170, 450)
GUICtrlSetData($Edit_1, $st)
$Button_2 = GUICtrlCreateButton("Play Game", 20, 490, 80, 30)
$Button_3 = GUICtrlCreateButton("Exit", 110, 490, 80, 30)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_2
            $read = GUICtrlRead($Edit_1)
            $selection = $read & ".swf"
            GUISetState(@SW_HIDE)
            _viewer()
            GUISetState(@SW_SHOW)
        Case $msg = $Button_3
            Exit
        Case Else
            ;;;
    EndSelect
WEnd
Exit

Func _viewer()
    $W = @DesktopWidth - 220
    $H = @DesktopHeight - 150
    $Form1 = GUICreate($read, $W, $H, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
    $getz = WinGetClientSize($Form1)
    $get2 = ($getz[0] * .45)
    $get2b = ($getz[1] * .93)
    $getL = StringLen($get2)
    $getLb = StringLen($get2b)
    $get3 = StringInStr($get2, ".")
    $get3b = StringInStr($get2b, ".")
    $lenth = ($getL - $get3)
    $lenthb = ($getLb - $get3b)
    $ans = StringTrimRight($get2, $lenth + 1)
    $ansb = StringTrimRight($get2b, $lenthb + 1)
    $Obj = _IECreateEmbedded ()
    $browser = GUICtrlCreateObj ($Obj, 8, 8, $W - 20, $H - 70)
    GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
    _IENavigate ($Obj, 'about:blank')
    $oDoc = _IEDocGetObj ($Obj)
    $oDoc.body.style.overflow = "auto"
    $button_4 = GUICtrlCreateButton("End Game", $ans, $ansb, 80, 30)
    GUISetState(@SW_SHOW)
    $flash1 = @ScriptDir & "\" & $selection
    $sHTML = '<embed id=flashy src="' & $flash1 & '" '
    $sHTML &= 'quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" '
    $sHTML &= 'type="application/x-shockwave-flash" '
    $sHTML &= 'width="100%" height="100%"></embed>'
    _IEBodyWriteHTML ($Obj, $sHTML)
    Sleep(1500)
    $Obj1 = _IEGetObjByName ($Obj, "flashy")
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($Form1)
                ExitLoop
            Case $button_4
                GUIDelete($Form1)
                ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>_viewer
Link to comment
Share on other sites

Ok, I got it working pretty well. I'll post it to the scripts and scraps section in a bit, but I wonder if could be tweaked any better. Thoughts?

#Include <File.au3>
#include <GuiConstants.au3>
#include <GuiList.au3>
#include <Array.au3>
#include <ie.au3>
Dim $selection, $Form1
Dim $selection2
GUICreate("Flash Player by Volly", 220, 548, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$FileList = _FileListToArray (@ScriptDir, "*.swf", 1)
$atr = _ArrayTrim($FileList, 4, 1, 1)
$st = _ArrayToString($atr, "|", 1)
$Edit_1 = GUICtrlCreateList("", 20, 30, 170, 450)
GUICtrlSetData($Edit_1, $st)
$Button_2 = GUICtrlCreateButton("Play Game", 20, 490, 80, 30)
$Button_3 = GUICtrlCreateButton("Exit", 110, 490, 80, 30)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_2
            $read = GUICtrlRead($Edit_1)
            $selection = $read & ".swf"
            GUISetState(@SW_HIDE)
            _viewer()
            GUISetState(@SW_SHOW)
        Case $msg = $Button_3
            Exit
        Case Else
            ;;;
    EndSelect
WEnd
Exit

Func _viewer()
    $W = @DesktopWidth - 220
    $H = @DesktopHeight - 150
    $Form1 = GUICreate($read, $W, $H, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
    $getz = WinGetClientSize($Form1)
    $get2 = ($getz[0] * .45)
    $get2b = ($getz[1] * .93)
    $getL = StringLen($get2)
    $getLb = StringLen($get2b)
    $get3 = StringInStr($get2, ".")
    $get3b = StringInStr($get2b, ".")
    $lenth = ($getL - $get3)
    $lenthb = ($getLb - $get3b)
    $ans = StringTrimRight($get2, $lenth + 1)
    $ansb = StringTrimRight($get2b, $lenthb + 1)
    $Obj = _IECreateEmbedded ()
    $browser = GUICtrlCreateObj ($Obj, 8, 8, $W - 20, $H - 70)
    GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
    _IENavigate ($Obj, 'about:blank')
    $oDoc = _IEDocGetObj ($Obj)
    $oDoc.body.style.overflow = "auto"
    $button_4 = GUICtrlCreateButton("End Game", $ans, $ansb, 80, 30)
    GUISetState(@SW_SHOW)
    $flash1 = @ScriptDir & "\" & $selection
    $sHTML = '<embed id=flashy src="' & $flash1 & '" '
    $sHTML &= 'quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" '
    $sHTML &= 'type="application/x-shockwave-flash" '
    $sHTML &= 'width="100%" height="100%"></embed>'
    _IEBodyWriteHTML ($Obj, $sHTML)
    Sleep(1500)
    $Obj1 = _IEGetObjByName ($Obj, "flashy")
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($Form1)
                ExitLoop
            Case $button_4
                GUIDelete($Form1)
                ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>_viewer
non sequitur, but I love your AVATAR.

makes me laugh everytime i see it.

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Link to comment
Share on other sites

just messing around with it and added a combo box

also have all .swf files in @ScriptDir & "\Flash\*.swf

to keep it more organized

#include <GUIConstants.au3>
#include <GuiCombo.au3>
#include <ie.au3>
Dim $Form1

$Main = GUICreate("Flash Player", 218, 109, -1, -1)
$Combo1 = GUICtrlCreateCombo("", 8, 16, 201, 220, $CBS_DROPDOWNLIST)
_GUICtrlComboAddDir($Combo1, "A,D,H,RO,RW", @ScriptDir & "\Flash\*.swf")
$Play = GUICtrlCreateButton("Play", 8, 64, 75, 25, $BS_DEFPUSHBUTTON)
$Close = GUICtrlCreateButton("Close", 136, 64, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Close
            Exit
        Case $msg = $Play
            Global $file = GUICtrlRead($Combo1)
            GUISetState(@SW_HIDE)
            _viewer()
            GUISetState(@SW_SHOW)   
    EndSelect
WEnd


Func _viewer()
    $W = @DesktopWidth - 220
    $H = @DesktopHeight - 150
    $Form1 = GUICreate($file, $W, $H, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
    $getz = WinGetClientSize($Form1)
    $get2 = ($getz[0] * .45)
    $get2b = ($getz[1] * .93)
    $getL = StringLen($get2)
    $getLb = StringLen($get2b)
    $get3 = StringInStr($get2, ".")
    $get3b = StringInStr($get2b, ".")
    $lenth = ($getL - $get3)
    $lenthb = ($getLb - $get3b)
    $ans = StringTrimRight($get2, $lenth + 1)
    $ansb = StringTrimRight($get2b, $lenthb + 1)
    $Obj = _IECreateEmbedded ()
    $browser = GUICtrlCreateObj ($Obj, 8, 8, $W - 20, $H - 70)
    GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
    _IENavigate ($Obj, 'about:blank')
    $oDoc = _IEDocGetObj ($Obj)
    $oDoc.body.style.overflow = "auto"
    $button_4 = GUICtrlCreateButton("End Game", $ans, $ansb, 80, 30)
    GUISetState(@SW_SHOW)
    $flash1 = @ScriptDir & "\Flash\" & $file
    $sHTML = '<embed id=flashy src="' & $flash1 & '" '
    $sHTML &= 'quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" '
    $sHTML &= 'type="application/x-shockwave-flash" '
    $sHTML &= 'width="100%" height="100%"></embed>'
    _IEBodyWriteHTML ($Obj, $sHTML)
    Sleep(1500)
    $Obj1 = _IEGetObjByName ($Obj, "flashy")
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($Form1)
                ExitLoop
            Case $button_4
                GUIDelete($Form1)
                ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>_viewer
Edited by CWorks
Link to comment
Share on other sites

@cworks: The filenames that are listed have the file ext. shown in the name. Also, it is only showing 15 items, when I have 47. I like the idea on the flash folder for organization.

@blademonkey: I didn't write the flashplayer itself. This was shown to me by GaFrost, and I tweaked it to suit my needs. Basically, the viewer function is someone elses (except the part that adds the button and it's position), and the other part is mine.

Link to comment
Share on other sites

is there such a thing as a list with a scroll bar

I also had a problem with the "End Game" button @2048 x 1536 & 1600 x 1200 it wasn't centered and was up to high so i tweaked it until it worked for all sizes

well only tested down to 1024 x 768

#include <GUIConstants.au3>
#include <GuiCombo.au3>
#include <ie.au3>
Dim $Form1

GUICreate("Flash Player", 218, 109, -1, -1)
$Combo1 = GUICtrlCreateCombo("", 8, 16, 201, 800, $CBS_DROPDOWNLIST)
_GUICtrlComboAddDir($Combo1, "A,D,H,RO,RW", @ScriptDir & "\Flash\*.swf")
$Play = GUICtrlCreateButton("Play", 8, 64, 75, 25, $BS_DEFPUSHBUTTON)
$Close = GUICtrlCreateButton("Close", 136, 64, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Close
            Exit
        Case $msg = $Play
            Global $file = GUICtrlRead($Combo1)
            GUISetState(@SW_HIDE)
            _viewer()
            GUISetState(@SW_SHOW)   
    EndSelect
WEnd


Func _viewer()
    $W = @DesktopWidth - 40
    $H = @DesktopHeight - 80
    $Form1 = GUICreate($file, $w, $h, -1, -1, $WS_BORDER+$WS_CAPTION+$WS_POPUP+$WS_SYSMENU+$WS_POPUP+$WS_MAXIMIZEBOX+$WS_MINIMIZEBOX)
    $getz = WinGetClientSize($Form1)
    $get2 = ($getz[0] * .45)
    $get2b = ($getz[1] * .95)
    $getL = StringLen($get2)
    $getLb = StringLen($get2b)
    $get3 = StringInStr($get2, ".")
    $get3b = StringInStr($get2b, ".")
    $lenth = ($getL - $get3)
    $lenthb = ($getLb - $get3b)
    $ans = StringTrimRight($get2, $lenth + 1)
    $ansb = StringTrimRight($get2b, $lenthb + 1)
    $Obj = _IECreateEmbedded ()
    $browser = GUICtrlCreateObj ($Obj, 8, 8, $W - 20, $H - 70)
    GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
    _IENavigate ($Obj, 'about:blank')
    $oDoc = _IEDocGetObj ($Obj)
    $oDoc.body.style.overflow = "auto"
    $button_4 = GUICtrlCreateButton("End Game", $ans, $ansb, 80, 30)
    GUISetState(@SW_SHOW)
    $flash1 = @ScriptDir & "\Flash\" & $file
    $sHTML = '<embed id=flashy src="' & $flash1 & '" '
    $sHTML &= 'quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" '
    $sHTML &= 'type="application/x-shockwave-flash" '
    $sHTML &= 'width="100%" height="100%"></embed>'
    _IEBodyWriteHTML ($Obj, $sHTML)
    Sleep(1500)
    $Obj1 = _IEGetObjByName ($Obj, "flashy")
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($Form1)
                ExitLoop
            Case $button_4
                GUIDelete($Form1)
                ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>_viewer
Edited by CWorks
Link to comment
Share on other sites

got bored so i added some more to it

create four folders under \Flash\ folder called

Games1 Games2 Games3 Games4

just split the files up into smaller groups so they all show up in combobox

there's 4 radio boxes to choose which folder to read and add to combobox

#include <GUIConstants.au3>
#include <GuiCombo.au3>
#include <ie.au3>
Dim $Form1
Dim $file
$GF = "Games1"

_MYLoop()
Func _MYLoop()
$Main = GUICreate("Flash Player by Volly", 219, 199)
$Combo1 = GUICtrlCreateCombo("", 8, 16, 201, 800, $CBS_DROPDOWNLIST)
_GUICtrlComboAddDir($Combo1, "A,D,H,RO,RW", @ScriptDir & "\Flash\" & $GF & "\*.swf")
$Play = GUICtrlCreateButton("Play", 8, 160, 91, 25)
$Close = GUICtrlCreateButton("Close", 120, 160, 91, 25)
$Group1 = GUICtrlCreateGroup("Folders", 8, 40, 201, 105)
$Games1 = GUICtrlCreateRadio("Games 1", 24, 64, 65, 25, $BS_PUSHLIKE)
If $GF = "Games1" Then GUICtrlSetState(-1, $GUI_CHECKED)
$Games2 = GUICtrlCreateRadio("Games 2", 128, 64, 65, 25, $BS_PUSHLIKE)
If $GF = "Games2" Then GUICtrlSetState(-1, $GUI_CHECKED)
$Games3 = GUICtrlCreateRadio("Games 3", 24, 104, 65, 25, $BS_PUSHLIKE)
If $GF = "Games3" Then GUICtrlSetState(-1, $GUI_CHECKED)
$Games4 = GUICtrlCreateRadio("Games 4", 128, 104, 65, 25, $BS_PUSHLIKE)
If $GF = "Games4" Then GUICtrlSetState(-1, $GUI_CHECKED)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Close
            Exit
        Case $msg = $Play
            $file = GUICtrlRead($Combo1)
            GUISetState(@SW_HIDE)
            _viewer()
            GUISetState(@SW_SHOW)
        Case $msg = $Games1
            $GF = "Games1"
            GUIDelete($Main)
            _MYLoop()
        Case $msg = $Games2
            $GF = "Games2"
            GUIDelete($Main)
            _MYLoop()
        Case  $msg = $Games3
            $GF = "Games3"
            GUIDelete($Main)
            _MYLoop()
        Case $msg = $Games4
            $GF = "Games4"
            GUIDelete($Main)
            _MYLoop()
    EndSelect
WEnd
EndFunc

Func _viewer()
    $W = @DesktopWidth - 40
    $H = @DesktopHeight - 80

    $Form1 = GUICreate($file, $w, $h, -1, -1, $WS_BORDER+$WS_CAPTION+$WS_SYSMENU+$WS_MAXIMIZEBOX+$WS_MINIMIZEBOX+$WS_SIZEBOX)
    $getz = WinGetClientSize($Form1)
    $get2 = ($getz[0] * .45)
    $get2b = ($getz[1] * .95)
    $getL = StringLen($get2)
    $getLb = StringLen($get2b)
    $get3 = StringInStr($get2, ".")
    $get3b = StringInStr($get2b, ".")
    $lenth = ($getL - $get3)
    $lenthb = ($getLb - $get3b)
    $ans = StringTrimRight($get2, $lenth + 1)
    $ansb = StringTrimRight($get2b, $lenthb + 1)
    $Obj = _IECreateEmbedded ()
    $browser = GUICtrlCreateObj ($Obj, 8, 8, $W - 20, $H - 70)
    GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
    _IENavigate ($Obj, 'about:blank')
    $oDoc = _IEDocGetObj ($Obj)
    $oDoc.body.style.overflow = "auto"
    $button_4 = GUICtrlCreateButton("End Game", $ans, $ansb, 80, 30)
    GUISetState(@SW_SHOW)
    $flash1 = @ScriptDir & "\Flash\" & $GF & "\" & $file
    $sHTML = '<embed id=flashy src="' & $flash1 & '" '
    $sHTML &= 'quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" '
    $sHTML &= 'type="application/x-shockwave-flash" '
    $sHTML &= 'width="100%" height="100%"></embed>'
    _IEBodyWriteHTML ($Obj, $sHTML)
    Sleep(1500)
    $Obj1 = _IEGetObjByName ($Obj, "flashy")
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($Form1)
                ExitLoop
            Case $button_4
                GUIDelete($Form1)
                ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>_viewer
Edited by CWorks
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...