Sign in to follow this  
Followers 0

Progress issue

4 posts in this topic

#1 ·  Posted (edited)

Hello everyone

I have been trying to figure out creating progress bar, which is designed around checking if a process exists then switch off when process has terminated.

This is what i have thus far it doesn't really poll the progress bar for the entire duration of when the process exists. it flashes on then closes down. I have tested it by launching notepad then activating the script, the script finishes along with the progress bar. but i would like the progress bar to remain and continue to scroll the progress bar until notepad has been closed, then display complete and close off the progress bar.

$notepad = ProcessExists("notepad.exe")
$bnotepad = $notepad ==0
For $i = 1 To $notepad
   ProgressSet($i/$bnotepad*100,"","Running " & $bnotepad)
ProgressSet($i/$bnotepad*100,"","Notepad closed down")

Is there a better way such as using some form of an animated .gif to simplify it? and if so could a small demo be provided if possible.

Any assistance would be great

thanks is advance


Edited by failedtocompile

Share this post

Link to post
Share on other sites

#2 ·  Posted (edited)

Surely instead of the For loop you want a While loop?

Currently, the For loop doesnt actually loop because $i=1 and so does $ it just exits the loops..

If you had...

$bnotepad = $notepad ==0
While ProcessExists("notepad.exe")>0
   ProgressSet(100,"","Running " & $bnotepad)
ProgressSet(0,"","Notepad closed down")

EDIT: I have just tested this and it works, altho im not sure what you mean about the animating the progress, so i just put it as 100, so you can see what i mean.

Edited by furrycow

Instant Lockerz Invite -

Share this post

Link to post
Share on other sites

I don't know if that could be done if you want the progress bar running while your notepad.exe is running.

I think you should create loading bar instead.

Share this post

Link to post
Share on other sites

Hi ! If I were you, I would go with animated GIFs ...

Take a look at this,


THE FOLLOWING CODE BELONGS TO "trancexx" ... I think .... anyway, I have tried it, and it work JUST FINE !

#include <WindowsConstants.au3>
#include "GIFAnimation.au3"

Opt("MustDeclareVars", 1)

Global $hGui = GUICreate("GIF Animation", 500, 500, -1, -1, $WS_OVERLAPPEDWINDOW)

Global $sFile = FileOpenDialog("Choose gif", "", "(*.gif)", -1, "", $hGui)
If @error Then Exit

Global $aGIFArrayOfIconHandles
Global $hGIFThread
Global $iGIFTransparent
Global $tFrameCurrent

Global $hGIF = _GUICtrlCreateGIF($sFile, 10, 10, $aGIFArrayOfIconHandles, $hGIFThread, $iGIFTransparent, $tFrameCurrent)
GUICtrlSetTip($hGIF, "GIF")

Global $hButton = GUICtrlCreateButton("Stop animation", 50, 450, 100, 25)
Global $hButton1 = GUICtrlCreateButton("Delete GIF", 200, 450, 100, 25)
Global $hButton2 = GUICtrlCreateButton("Open GIF", 350, 450, 100, 25)

GUIRegisterMsg(15, "_Refresh"); WM_PAINT; don't forget this. It's needed only for non-transparent gifs though, but still.

Global $iPlay = 1


While 1

    Switch GUIGetMsg()
        Case - 3
        Case $hButton
            If $iPlay Then
                If _StopGIFAnimation($hGIFThread) Then
                    $iPlay = 0
                    GUICtrlSetData($hButton, "Resume animation")
                If _ResumeGIFAnimation($hGIFThread) Then
                    $iPlay = 1
                    GUICtrlSetData($hButton, "Stop animation")
        Case $hButton1
            _GUICtrlDeleteGIF($hGIF, $aGIFArrayOfIconHandles, $hGIFThread, $tFrameCurrent)
        Case $hButton2
            $sFile = FileOpenDialog("Choose gif", "", "(*.gif)", -1, "", $hGui)
            If Not @error Then
                _GUICtrlDeleteGIF($hGIF, $aGIFArrayOfIconHandles, $hGIFThread, $tFrameCurrent); if already there
                $hGIF = _GUICtrlCreateGIF($sFile, 10, 10, $aGIFArrayOfIconHandles, $hGIFThread, $iGIFTransparent, $tFrameCurrent)
                GUICtrlSetTip($hGIF, "GIF")
                $iPlay = 1
                GUICtrlSetData($hButton, "Stop animation")


Func _Refresh($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $wParam, $lParam

    _RefreshGIF($hGIF, $aGIFArrayOfIconHandles, $hGIFThread, $iGIFTransparent, $tFrameCurrent)


[s][font="Impact"]░▒▓▓►DrKovra◄▓▓▒░[/font][/s]The only thing I [sup]know [/sup]is that I don't know [sub]nothing[/sub]--------------- __________------------------------------ __________---------------

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