Sign in to follow this  
Followers 0
Bert

Animated gif wont work right in window

9 posts in this topic

I have a script I found in the scrapts section, and I wanted to quickly tweak it for a friend of mine. Everything is great, except for one thing. When I try to run the radar loop, it only shows the first frame. Not sure on how to get that working. Any thoughts?

Dim $pic = 1, $BS_FLAT = 0x8000

;This is smaller than 800x600, so you should have no troubles using that resolution
$gui1 =       GUICreate("Weather Maps", 700, 515, (@DesktopWidth - 750) / 2, 50)
DirCreate(@TempDir & "\WeatherMaps")
InetGet("http://image.weather.com/web/radar/us_ric_closeradar_medium_usen.jpg", @TempDir & "\WeatherMaps\dopplar.jpg", 1, 0)
$echo =       GUICtrlCreatePic(@TempDir & "\WeatherMaps\dopplar.jpg", 0, 0, 700, 485)
$dopplar =    GUICtrlCreateButton("Doppler Radar", 0, 490, 100, 20, $BS_FLAT)
$trops =      GUICtrlCreateButton("Tropics", 105, 490, 100, 20, $BS_FLAT)
$lightning =  GUICtrlCreateButton("Lightning", 210, 490, 100, 20, $BS_FLAT)
$24rainfall = GUICtrlCreateButton("Predicted Rainfall", 315, 490, 100, 20, $BS_FLAT)
$drought =    GUICtrlCreateButton("Drought Severity", 420, 490, 100, 20, $BS_FLAT)
$temps =      GUICtrlCreateButton("Temperatures", 525, 490, 100, 20, $BS_FLAT)
;Had some extra room so I stuck this in, could be used for many things
$loop =        GUICtrlCreateButton("Radar Loop", 630, 490, 70, 20, $BS_FLAT)

GUISetState(@SW_SHOW, $gui1)
AdlibEnable("_GetEcho", 30000)

While 1
   $get = GUIGetMsg()
   Select
      Case $get = -3
         Exit
      Case $get = $dopplar
         $pic = 1
         _GetEcho()
      Case $get = $trops
         $pic = 2
         _GetEcho()
      Case $get = $lightning
         $pic = 3
         _GetEcho()
      Case $get = $24rainfall
         $pic = 4
         _GetEcho()
      Case $get = $drought
         $pic = 5
         _GetEcho()
      Case $get = $temps
         $pic = 6
         _GetEcho()
      Case $get = $loop
         $pic = 7
        _GetEcho()
   EndSelect
WEnd

Func _GetEcho()
   If $pic = 1 Then
      InetGet("http://image.weather.com/web/radar/us_ric_closeradar_medium_usen.jpg", @TempDir & "\WeatherMaps\dopplar.jpg", 1, 0)
      $name = "\dopplar.jpg"
   ElseIf $pic = 2 Then
      InetGet("http://image.weather.com/images/sat/tropsat_600x405.jpg", @TempDir & "\WeatherMaps\trops.jpg", 1, 0)
      $name = "\trops.jpg"
   ElseIf $pic = 3 Then
      InetGet("http://image.weather.com/images/maps/severe/map_light_ltst_4namus_enus_600x405.jpg", @TempDir & "\WeatherMaps\lightning.jpg", 1, 0)
      $name = "\lightning.jpg"
   ElseIf $pic = 4 Then
      InetGet("http://image.weather.com/web/maps/radar/regions/us_rainfall_est_yesterday_600_en.jpg", @TempDir & "\WeatherMaps\24rainfall.jpg", 1, 0)
      $name = "\24rainfall.jpg"
   ElseIf $pic = 5 Then
      InetGet("http://image.weather.com/images/maps/current/palmer_drought_720x486.jpg", @TempDir & "\WeatherMaps\drought.jpg", 1, 0)
      $name = "\drought.jpg"
   ElseIf $pic = 6 Then
      InetGet("http://image.weather.com/images/maps/current/acttemp_600x405.jpg", @TempDir & "\WeatherMaps\temps.jpg", 1, 0)
      $name = "\temps.jpg"
   ElseIf $pic = 7 Then
      InetGet("http://images.intellicast.com/WeatherImg/RadarLoop/shd_None_anim.gif", @TempDir & "\WeatherMaps\loop.gif", 1, 0)
      $name = "\loop.gif"     
   EndIf
   GUICtrlSetImage($echo, @TempDir & "\WeatherMaps\" & $name)
EndFunc;==>_GetEcho

Func OnAutoItExit()
   AdlibDisable()
   GUIDelete($gui1)
   DirRemove(@TempDir & "\WeatherMaps\", 1)
EndFunc;==>OnAutoItExit

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Tried this, and it didn't work. still not sure what I'm doing wrong. It seems it won't pull down the radar loop I'm trying to get.

http://www.intellicast.com/IcastPage/LoadP...mp;prodnav=none

#include <IE.au3>
#include <GUIConstants.au3>

_Main()

Func _Main()
    Local $pheight = 50, $pwidth = 50, $gif, $gif_control, $Form1, $Button1, $Button2, $msg, $loop
    ;$gif = FileOpenDialog("Select Animated Gif", @ScriptDir, "gif files (*.gif)", 3)
    ;If @error Then Exit
    $Form1 = GUICreate("Animated GIF demo", 622, 448, 192, 125)
    $Button1 = GUICtrlCreateButton("Stop", 8, 8, 81, 25)
    $Button2 = GUICtrlCreateButton("Resume", 96, 8, 81, 25)
    $gif = InetGet("http://images.intellicast.com/WeatherImg/RadarLoop/shd_None_anim.gif", @ScriptDir&"\loop.gif")
    $loop = "\loop.gif"
    $gif_control=_GUICtrlCreateGIF($loop,8,40,0)
    GUISetState(@SW_SHOW)
    While 1
        $msg = GuiGetMsg()
        Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg=$Button1
            _GUICtrlStopGIF($gif_control)
        Case $msg=$Button2
            _GUICtrlResumeGIF($gif_control)
        Case Else
            ;;;;;;;
        EndSelect
    WEnd
    Exit
EndFunc
 
Func _GUICtrlCreateGIF($gif,$x=0,$y=0,$border=0)
    Local $pwidth,$pheight,$oIE,$GUIActiveX
    _GetGifPixWidth_Height($gif, $pwidth, $pheight)
    $oIE = ObjCreate("Shell.Explorer.2")
    $GUIActiveX = GUICtrlCreateObj($oIE, $x, $y, $pwidth, $pheight)
    $oIE.navigate ("about:blank")
    While _IEPropertyGet($oIE, "busy")
        Sleep(100)
    WEnd
    $oIE.document.body.background = $gif
    $oIE.document.body.scroll = "no"
    if $border=0 then $oIE.document.body.style.border = "0px"
    Return $oIE
EndFunc

Func _GUICtrlStopGIF($Control)
    _IEAction ($Control, "stop" ) ; stop
EndFunc

Func _GetGifPixWidth_Height($s_gif, ByRef $pwidth, ByRef $pheight)
    If FileGetSize($s_gif) > 9 Then
        Local $sizes = FileRead($s_gif, 10)
        ConsoleWrite("Gif version: " & StringMid($sizes, 1, 6) & @LF)
        $pwidth = Asc(StringMid($sizes, 8, 1)) * 256 + Asc(StringMid($sizes, 7, 1))
        $pheight = Asc(StringMid($sizes, 10, 1)) * 256 + Asc(StringMid($sizes, 9, 1))
        ConsoleWrite($pwidth & " x " & $pheight & @LF)
    EndIf
EndFunc   ;==>_GetGifPixWidth_Height

Func _GUICtrlResumeGIF($Control)
    $Control.document.body.background = $Control.document.body.background ;resume
EndFunc
Edited by Volly

Share this post


Link to post
Share on other sites

change line 14 from this

$loop = "\loop.gif"oÝ÷ ÚÚ-+ºÚ"µÍÌÍÛÛÜHØÜ[É][ÝÉÌLÛÛÜÚY][Ý

and it will work! At least it does here....


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Perfection! thanks! My boss will be very happy. She is a weather nut, and asked me if I had any scripts that would give her stuff she wanted all in one thing. This will do the trick for what I had in mind. :whistle:

well, then enjoy it....


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

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