Sign in to follow this  
Followers 0
Glowshi

Redraw Flash Object?

11 posts in this topic

I wrote a little script for listening to the Pandora music player in AutoIt and basically it just opens the Pandora webpage in an IE object and resizes it to just show the flash based player in a window. My problem is that whenever I minimize and then restore the window or drag another window over it the flash object turns white or blocky and doesn't always redraw properly. Is there any way to refresh the object every few seconds or some redraw property Im missing? I'm confused because if I just open the page in a normal browser window and do the same thing the flash object always redraws fine. It's only when the page is loaded in AutoIt.

I'm using Beta 3.1.1.120

#include <GUIConstants.au3>
#include <IE_T2.0_3.au3>
Opt("GUIOnEventMode", 1)

GUICreate ( "Pandora Player", 100, 100 )
$Size = WinGetPos ( "Pandora Player" )
$WidthOffset = $Size[2] - 100
$HightOffset = $Size[3] - 100

$oIE = ObjCreate("Shell.Explorer.2")
$GUIActiveX = GUICtrlCreateObj ( $oIE, 0, 0, 100, 100 )
$oIE.navigate ( "http://pandora.com/" )
While _IEGetProperty ( $oIE, "busy" )
  Sleep(100)
WEnd

$Radio = _IEGetObjByName ( $oIE, "TunerContainer" )

$Left = $Radio.offsetLeft
$Parent = $Radio.offsetParent
While IsObj($Parent)
  $Left = $Left + $Parent.offsetLeft
  $Parent = $Parent.offsetParent
WEnd
$Top = $Radio.offsetTop
$Parent = $Radio.offsetParent
While IsObj($Parent)
  $Top = $Top + $Parent.offsetTop
  $Parent = $Parent.offsetParent
WEnd
$Width = $Radio.offsetWidth
$Height = $Radio.offsetHeight

WinMove("Pandora Player","",default, default, $Width+$WidthOffset,$Height+$HightOffset)
GUICtrlSetPos ( $GUIActiveX, $Left*(-1), $Top*(-1), $Width+$Left, $Height+$Top )

$oIE.document.body.scroll = "no"
$oIE = 0

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUISetState ()

While 1
  Sleep(1000)
WEnd

Func CLOSEClicked()
  GUIDelete ()
  Exit
EndFunc

Thanks in advance

Share this post


Link to post
Share on other sites



Flash redraws itself. As for your problem, I really have no idea what's wrong.

It should draw itself whenever it receives a WM_PAINT message as well as at each frame interval. Flash handles those things automatically.

Why not just load the ActiveX control instead of IE control?

Share this post


Link to post
Share on other sites

Flash redraws itself. As for your problem, I really have no idea what's wrong.

It should draw itself whenever it receives a WM_PAINT message as well as at each frame interval. Flash handles those things automatically.

Why not just load the ActiveX control instead of IE control?

If I could just load the ActiveX control I would but there's way too much going on at that site for me to figure out how. Is there a way I can send a WM_PAINT message to the window or the control to force a repaint? Right now I just hide and then show the window whenever it's clicked which works but isn't a very elegant solution. Perhaps its just my computer? Maybe my video drivers? So confused.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

#NoTrayIcon
$oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
GUICreate("Pandora", 640, 250, -1, -1)
$GUIActiveX = GUICtrlCreateObj($oRP, 0, 0, 640, 250)

With $oRP
    .bgcolor = "#FFFFFF"
    .Movie = 'https://www.pandora.com:443/radio/tuner_6_9_0_4.swf'
    .MENU = "false"
    .FlashVars = "_tunervar_shost=www.pandora.com&" & _
    "_tunervar_amazonurl=http%3A%2F%2Fwww.amazon.com%2Fexec%2Fobidos%2Fredirect%3Ftag%3Dsavagebeast-20&" & _
    "_tunervar_host=www.pandora.com&" & _
    "_tunervar_ar=0&" & _
    "_tunervar_port=80&" & _
    "_tunervar_sport=443&" & _
    "_tunervar_itunesurl=http%3A%2F%2Fclick.linksynergy.com%2Ffs-bin%2Fstat%3Fid%3DFLenzF8lvbI%26offerid%3D78941%26type%3D3%26subid%3D0%26tmpid%3D1826"
EndWith

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = -3; GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd
It does some javascipt than loads IE 3 times real quickly. Not sure how tho. Might want to be careful, they might not like you getting by without the ads.

Edit: put flashvars on multiple lines, added #NoTrayIcon

Also it seems like there is another Flash thing right after this on the pandora webpage. Not sure what its for yet.

Edited by gamerman2360

Share this post


Link to post
Share on other sites

Well, the ad code is alwas confusing... Tons of javascript. All I found was this http://pandora.com/include/skyscraperEmbed.html. Not sure how/if I could put this in the script some how so non-subscribers can see it.

Share this post


Link to post
Share on other sites

It does some javascipt than loads IE 3 times real quickly. Not sure how tho. Might want to be careful, they might not like you getting by without the ads.

Edit: put flashvars on multiple lines, added #NoTrayIcon

Also it seems like there is another Flash thing right after this on the pandora webpage. Not sure what its for yet.

I tried that code but it doesn't load up right. Part of the player is displayed but then it errors out. Granted the part that did load always repaited fine with no whiteness or blockyness. Me thinks the player can't be loaded by itself.

Share this post


Link to post
Share on other sites

I'm using the script right now. Do you have the latest Flash player?

Share this post


Link to post
Share on other sites

I'm using the script right now. Do you have the latest Flash player?

Ok, now it works for some reason and I feel somewhat retarded. The first couple times I tried it a thing would come down and say it had some server error but in a normal web browser it still worked fine. However, now that it is working whenever it switches songs everything flashes and goes crazy and theres a chime sound... Does it reload the browser three times for each song?

Thanks for getting it this far

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

No, once after each song afterward. It's some javascript it's calling through the browser. I've already looked at events, nothing. I just had a good idea. brb

Edit: might take some time

Edited by gamerman2360

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

There we go. If it needs a web browser, give it a webbrowser!

CODE
$oIE = ObjCreate("InternetExplorer.Application")

With $oIE

.navigate("http://www.pandora.com/?cmd=tunermini")

.width = 640 + 8

.height = 250 + 34

.menubar = False

.toolbar = False

.statusbar = False

.addressbar = False

.resizable = False

While .busy

Sleep(100)

WEnd

.document.body.style.overflow = "hidden"

.visible = True

EndWith

Edit:reedited to make as simple as possible Edited by gamerman2360

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Seems there is a problem getting the flash movie to redraw when the window is shown again.

Edit: Wait... That was the original problem, lol.

Edited by gamerman2360

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  
Followers 0