Jump to content
Sign in to follow this  
rocksolidsr

Flash in GUI

Recommended Posts

rocksolidsr

I'm trying to load the dc101 music player in a GUI but it never seems to load can anyone give me some help

#include <GUIConstantsEx.au3>
GUICreate("Title Goes Here", 600, 500)
GUISetState(@SW_SHOW)

$Flash = ObjCreate("ShockwaveFlash.ShockwaveFlash")
$FlashObj = GUICtrlCreateObj($Flash, 0, 0, 600, 500)
$Flash.Movie = "http://www.dc101.com/mediaplayer/?station=WWDC-FM&action=listenlive&channel_title=CCB-20091104.swf"

$Flash.Loop = True
while(1)

WEnd

Share this post


Link to post
Share on other sites
clevername47

The file you are trying to reference is not a .swf file (it's the full link to the HTML page). The correct link is http://www.dc101.com/mediaplayer/CCB-20091104.swf. The following code loads the SWF successfully, but the SWF has an error box.

#include <GUIConstantsEx.au3>
GUICreate("Title Goes Here", 600, 500)
GUISetState(@SW_SHOW)

$Flash = ObjCreate("ShockwaveFlash.ShockwaveFlash")
$FlashObj = GUICtrlCreateObj($Flash, 0, 0, 600, 500)
$Flash.Movie = "http://www.dc101.com/mediaplayer/CCB-20091104.swf"

$Flash.Loop = True
while(1)
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

I also added a basic message loop, which is a good idea.

The following is the way the WWDC page initializes the flash object:

//var station = getQueryVariable("station");
    var station = 'wwdc-fm';
    var item = getQueryVariable("item");
    var action = getQueryVariable("action");
    var program = getQueryVariable("program");
    
    var stream_id = '';
    var channel_title = 'ccb-20091104.swf';
    
    if (station == "ihm-ip") station = "ihr-ip";
    if (station == "") station = "ihr-ip";
    //if (action == "") action = "browse";
    
    
    if (station == "ihr-ip" && action == "") action = "browse";
 
    var flashvars = {
    station_name: station,
    action:action,
    item_id:item,
    program_id:program,
    stream_id:stream_id,
    channel_title:channel_title
    
    };
    var params = {
        menu:"false",
        scale:"noscale",
        allowFullScreen:"true",
        allowScriptAccess:"always",
        bgColor:"#000000"
    };
            
    swfobject.embedSWF("CCB-20091104.swf", "playerdiv", "980", "700", "9.0.124", false, flashvars, params);

I bet if you can replicate those parameters using the Flash object's properties in AutoIt, you can get it to play. I don't know how to do that though.

Edited by cameltoe47

Share this post


Link to post
Share on other sites
Valuater

Another example...

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
Opt("GUICloseOnEsc", 1)
Opt("PixelCoordMode", 0)

Opt("SendKeyDelay", 2) ;5 milliseconds
Opt("SendKeyDownDelay", 1) ;1 millisecond


Global $red = 0x990000, $blue = 0x003366, $purple = 0x663366, $green = 0x006600, $black = 0x000000
Global $Runner, $title = "Super Crazy Guitar Maniac Dexuxe 3", $step = 4

HotKeySet("{F5}", "_On_Off")
HotKeySet("{ESC}", "terminate")

$oGame = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
$GUI = GUICreate($title, 734 + 20, 414 + 20, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "terminate")
$GUIObj = GUICtrlCreateObj($oGame, 10, 10, 734, 414)

With $oGame
    .bgcolor = 0x000000
    .Movie = "http://www.notdoppler.com/files/supercrazyguitarmaniacdeluxe3.swf"
    .Loop = True
    .wmode = "Opaque"
EndWith

GUISetState()

While 1
    Sleep(10)
WEnd

Func _On_Off()
    $Runner = Not $Runner
    ToolTip("The bot is working", 25, 25, "Guitar Bot", 1)

    While $Runner

        $UpArrow = PixelGetColor(84, 100)
       
        If $UpArrow == $red Then ; looking for up arrow (red)
            While (PixelGetColor(84, 100) <> $black)
                Send("{UP down}")
            WEnd
            Send("{UP up}")
        ElseIf $UpArrow <> $black And PixelSearch(64, 98, 102, 102, $red, 10, $step) == 1 Then; looking for number 4
            While (PixelGetColor(84, 100) <> $black)
                Send("{4 down}")
            WEnd
            Send("{4 up}")
        EndIf
       
        $RightArrow = PixelGetColor(84, 151)
       
        If $RightArrow == $blue Then; looking for right arrow (blue)
            While (PixelGetColor(84, 151) <> $black)
                Send("{RIGHT down}")
            WEnd
            Send("{RIGHT up}")
        ElseIf $RightArrow <> $black And PixelSearch(64, 149, 102, 153, $blue, 10, $step) == 1 Then; looking for number 3
            While (PixelGetColor(84, 151) <> $black)
                Send("{3 down}")
            WEnd
            Send("{3 up}")
        EndIf
       
        $LeftArrow = PixelGetColor(84, 206)
       
        If $LeftArrow == $purple Then ; looking for left arrow (purple)
            While (PixelGetColor(84, 206) <> $black)
                Send("{LEFT down}")
            WEnd
            Send("{LEFT up}")
        ElseIf $LeftArrow <> $black And PixelSearch(64, 204, 102, 208, $purple, 10, $step) == 1 Then; looking for number 2
            While (PixelGetColor(84, 206) <> $black)
                Send("{2 down}")
            WEnd
            Send("{2 up}")
        EndIf
       
        $DownArrow = PixelGetColor(84, 258)
       
        If $DownArrow == $green Then ; looking for down arrow (green)
            While (PixelGetColor(84, 258) <> $black)
                Send("{DOWN down}")
            WEnd
            Send("{DOWN up}")
        ElseIf $DownArrow <> $black And PixelSearch(64, 256, 102, 260, $green, 10, $step) == 1 Then; looking for number 1
            While (PixelGetColor(84, 258) <> $black)
                Send("{1 down}")
            WEnd
            Send("{1 up}")
        EndIf
       
    WEnd
    ToolTip("")
EndFunc   ;==>_On_Off

Func terminate()
    Exit
EndFunc   ;==>terminate

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
clevername47

Another example...

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
Opt("GUICloseOnEsc", 1)
Opt("PixelCoordMode", 0)

Opt("SendKeyDelay", 2) ;5 milliseconds
Opt("SendKeyDownDelay", 1) ;1 millisecond


Global $red = 0x990000, $blue = 0x003366, $purple = 0x663366, $green = 0x006600, $black = 0x000000
Global $Runner, $title = "Super Crazy Guitar Maniac Dexuxe 3", $step = 4

HotKeySet("{F5}", "_On_Off")
HotKeySet("{ESC}", "terminate")

$oGame = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
$GUI = GUICreate($title, 734 + 20, 414 + 20, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "terminate")
$GUIObj = GUICtrlCreateObj($oGame, 10, 10, 734, 414)

With $oGame
 .bgcolor = 0x000000
 .Movie = "http://www.notdoppler.com/files/supercrazyguitarmaniacdeluxe3.swf"
 .Loop = True
 .wmode = "Opaque"
EndWith

GUISetState()

While 1
 Sleep(10)
WEnd

Func _On_Off()
 $Runner = Not $Runner
 ToolTip("The bot is working", 25, 25, "Guitar Bot", 1)

 While $Runner

 $UpArrow = PixelGetColor(84, 100)
 
 If $UpArrow == $red Then ; looking for up arrow (red)
 While (PixelGetColor(84, 100) <> $black)
 Send("{UP down}")
 WEnd
 Send("{UP up}")
 ElseIf $UpArrow <> $black And PixelSearch(64, 98, 102, 102, $red, 10, $step) == 1 Then; looking for number 4
 While (PixelGetColor(84, 100) <> $black)
 Send("{4 down}")
 WEnd
 Send("{4 up}")
 EndIf
 
 $RightArrow = PixelGetColor(84, 151)
 
 If $RightArrow == $blue Then; looking for right arrow (blue)
 While (PixelGetColor(84, 151) <> $black)
 Send("{RIGHT down}")
 WEnd
 Send("{RIGHT up}")
 ElseIf $RightArrow <> $black And PixelSearch(64, 149, 102, 153, $blue, 10, $step) == 1 Then; looking for number 3
 While (PixelGetColor(84, 151) <> $black)
 Send("{3 down}")
 WEnd
 Send("{3 up}")
 EndIf
 
 $LeftArrow = PixelGetColor(84, 206)
 
 If $LeftArrow == $purple Then ; looking for left arrow (purple)
 While (PixelGetColor(84, 206) <> $black)
 Send("{LEFT down}")
 WEnd
 Send("{LEFT up}")
 ElseIf $LeftArrow <> $black And PixelSearch(64, 204, 102, 208, $purple, 10, $step) == 1 Then; looking for number 2
 While (PixelGetColor(84, 206) <> $black)
 Send("{2 down}")
 WEnd
 Send("{2 up}")
 EndIf
 
 $DownArrow = PixelGetColor(84, 258)
 
 If $DownArrow == $green Then ; looking for down arrow (green)
 While (PixelGetColor(84, 258) <> $black)
 Send("{DOWN down}")
 WEnd
 Send("{DOWN up}")
 ElseIf $DownArrow <> $black And PixelSearch(64, 256, 102, 260, $green, 10, $step) == 1 Then; looking for number 1
 While (PixelGetColor(84, 258) <> $black)
 Send("{1 down}")
 WEnd
 Send("{1 up}")
 EndIf
 
 WEnd
 ToolTip("")
EndFunc ;==>_On_Off

Func terminate()
 Exit
EndFunc ;==>terminate

8)

Wow Valuater... that is pretty impressive! Too bad the window has to be active and on top though....

Share this post


Link to post
Share on other sites
Dolemite50

Another example...

Grrr! So THATS what happened to my old high score on Missle Command down at the bowling alley! Until you came along everybody thought I was far-out, even after ripping my parachute pants on my bike's banana seat. Thirty years later and the image still haunts me:

---- TOP PLAYERS ----

V-MAN 9,877,455

Dolemite50 234

Dolemite50 211

Dolemite50 177

Dolemite50 174

Dolemite50 150

Dolemite50 122

Dolemite50 109

Dolemite50 101

Dolemite50 88

psssh, "V-MAN",..how could I not have known?

Share this post


Link to post
Share on other sites
AlmarM

Another example...

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
Opt("GUICloseOnEsc", 1)
Opt("PixelCoordMode", 0)

Opt("SendKeyDelay", 2) ;5 milliseconds
Opt("SendKeyDownDelay", 1) ;1 millisecond


Global $red = 0x990000, $blue = 0x003366, $purple = 0x663366, $green = 0x006600, $black = 0x000000
Global $Runner, $title = "Super Crazy Guitar Maniac Dexuxe 3", $step = 4

HotKeySet("{F5}", "_On_Off")
HotKeySet("{ESC}", "terminate")

$oGame = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
$GUI = GUICreate($title, 734 + 20, 414 + 20, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "terminate")
$GUIObj = GUICtrlCreateObj($oGame, 10, 10, 734, 414)

With $oGame
    .bgcolor = 0x000000
    .Movie = "http://www.notdoppler.com/files/supercrazyguitarmaniacdeluxe3.swf"
    .Loop = True
    .wmode = "Opaque"
EndWith

GUISetState()

While 1
    Sleep(10)
WEnd

Func _On_Off()
    $Runner = Not $Runner
    ToolTip("The bot is working", 25, 25, "Guitar Bot", 1)

    While $Runner

        $UpArrow = PixelGetColor(84, 100)
       
        If $UpArrow == $red Then ; looking for up arrow (red)
            While (PixelGetColor(84, 100) <> $black)
                Send("{UP down}")
            WEnd
            Send("{UP up}")
        ElseIf $UpArrow <> $black And PixelSearch(64, 98, 102, 102, $red, 10, $step) == 1 Then; looking for number 4
            While (PixelGetColor(84, 100) <> $black)
                Send("{4 down}")
            WEnd
            Send("{4 up}")
        EndIf
       
        $RightArrow = PixelGetColor(84, 151)
       
        If $RightArrow == $blue Then; looking for right arrow (blue)
            While (PixelGetColor(84, 151) <> $black)
                Send("{RIGHT down}")
            WEnd
            Send("{RIGHT up}")
        ElseIf $RightArrow <> $black And PixelSearch(64, 149, 102, 153, $blue, 10, $step) == 1 Then; looking for number 3
            While (PixelGetColor(84, 151) <> $black)
                Send("{3 down}")
            WEnd
            Send("{3 up}")
        EndIf
       
        $LeftArrow = PixelGetColor(84, 206)
       
        If $LeftArrow == $purple Then ; looking for left arrow (purple)
            While (PixelGetColor(84, 206) <> $black)
                Send("{LEFT down}")
            WEnd
            Send("{LEFT up}")
        ElseIf $LeftArrow <> $black And PixelSearch(64, 204, 102, 208, $purple, 10, $step) == 1 Then; looking for number 2
            While (PixelGetColor(84, 206) <> $black)
                Send("{2 down}")
            WEnd
            Send("{2 up}")
        EndIf
       
        $DownArrow = PixelGetColor(84, 258)
       
        If $DownArrow == $green Then ; looking for down arrow (green)
            While (PixelGetColor(84, 258) <> $black)
                Send("{DOWN down}")
            WEnd
            Send("{DOWN up}")
        ElseIf $DownArrow <> $black And PixelSearch(64, 256, 102, 260, $green, 10, $step) == 1 Then; looking for number 1
            While (PixelGetColor(84, 258) <> $black)
                Send("{1 down}")
            WEnd
            Send("{1 up}")
        EndIf
       
    WEnd
    ToolTip("")
EndFunc   ;==>_On_Off

Func terminate()
    Exit
EndFunc   ;==>terminate

8)

I already thought I saw this code before, its my old SCGMD3 bot. *What didnt work for me in the end* ;)

EDIT: Linky :)

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.