timmy2

Seeking low-overhead Throbber

9 posts in this topic

I want my main script to to spawn another one that displays a simple box with some changeable text and an animated GIF throbber (aka. activity indicator). Something simple like what you get using ProgressOn, with changeable text like it has, but instead of a calibrated progress bar I just want the GIF to play until my script decides to close.

I'm hoping one of the more frequent users of this forum can point me to a snippet or example that does this.  I found numerous posts here about animated progress bars, transparent GIFs, etc., but they often include comments like "this technique uses a lot of CPU cycles", and the examples contain lots of code that is over my head. Perhaps I'm not searching for the right terms, and am instead getting bogged down in posts that deal with more sophisticated requirements.  Google took me to this article that creates the following box that's similar to my goal but it has controls I don't need AND I could not begin to extrapolate his suggestions into Autoit code.

 

progress-dialog.png

 

For future readers of this post here are a couple of sites that produce nice little animated GIF throbbers.

Ajaxload

Chimpy

 

Share this post


Link to post
Share on other sites



Break it down into pieces. First just get an animated gif on a gui.

The rest sounds quite easy...

Run("x.exe someparameters")

I'll try it but the last time I did this (roughly a couple years ago) Autoit GUI's couldn't "play" animated GIFs. (maybe transparency was involved, too -- I forget)  I just figured that was not an option.  Thank you for replying.

Share this post


Link to post
Share on other sites

Break it down into pieces. First just get an animated gif on a gui.

Here's my test script and the animated gif does not "animate".  What am I missing?

Example()

Func Example()
    Local $sFilePath = @ScriptDir & "\dot_chase.gif"



    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example", 400, 100)

    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    Local $hChild = GUICreate("", 64, 64, 20, 20, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGUI)

    ; Create a picture control with a transparent image.
    GUICtrlCreatePic($sFilePath, 0, 0, 64, 64)

    ; Display the child GUI.
    GUISetState(@SW_SHOW)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd

    ; Delete the previous GUIs and all controls.
    GUIDelete($hGUI)
    GUIDelete($hChild)


EndFunc   ;==>Example

 

dot_chase.gif

Share this post


Link to post
Share on other sites

Thank you @KaFu and @JohnOne!

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <FontConstants.au3>
#include <GIFAnimation.au3> ; UDF courtesy of trancexx

Global $sFilePath = @ScriptDir & "\dot_chase.gif"

; Create a GUI
Global $hGUI = GUICreate("Example", 400, 120,-1,-1,$WS_DLGFRAME)
GUISetBkColor ($COLOR_WHITE)
Global $sFont = "Arial"
GUISetFont(12,  $FW_NORMAL, $GUI_FONTNORMAL, $sFont)
GUICtrlCreateLabel("Some info for you", 85,38)

; Display the GUI.
GUISetState(@SW_SHOW, $hGUI)

; Add the animated GIF
Global $hGIF = _GUICtrlCreateGIF($sFilePath, "", 10, 15)

; Display the animated GIF
GUISetState(@SW_SHOW)

; Loop until the user exits
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

; Delete the previous GUIs
GUIDelete($hGUI)

 

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