Jump to content
Sign in to follow this  
lafafmentvotre

Script pause with Progressbar

Recommended Posts

lafafmentvotre

Hi everybody and sorry for my bad english by advance

I need a progressbar who are updated during different actions of my script.

I use this function :

Func WaitExecuteShowProcess()
$xprogress=0
While ProcessExists("progress.exe")
$xprogress=$xprogress+1
if $xprogress=100 then $xprogress=0
Sleep(30)
GUICtrlSetData($Progressbar, $xprogress)
WEnd
EndFunc

This is the action :

While 1
$u_msg = GUIGetMsg(1)
Select
Case $u_msg[0] = $GUI_EVENT_CLOSE Or $u_msg[0] = $exititem Or $u_msg[0] = $exitbutton 
ExitLoop
Case $u_msg[0] = $all
Check_all()
Case $u_msg[0] = $none
Uncheck_all()
Case $u_msg[0]=$exportbutton Or $u_msg[0]=$exportitem;Export data
Run("progress.exe")
WaitExecuteShowProcess();the progressbar function
sauvegarde();the different actions to save different folders checked in my Gui
GUICtrlSetData ($progressbar,0)
GUICtrlSetState($progressbar,$GUI_DISABLE)
Wend

and the "process.exe" :

#NoTrayIcon
TraySetState(2)
While 1
$msg = TrayGetMsg()
Select
Case $msg = 0
ContinueLoop
EndSelect
WEnd
Exit

I do a Processclose("progress.exe") at the end of my sauvegarde() function.

But the sauvegarde() function don't run because the WaitExecuteShowProcess() function pause script.

Someone have an idea or issue to solve my problem ?

Thanks for help

Edited by lafafmentvotre

Share this post


Link to post
Share on other sites
99ojo

Hi,

what expected you with this code. You check ProcessExists. The process is closed by function call after WaitExecuteShowProcess.

While ProcessExists("progress.exe")
$xprogress=$xprogress+1
if $xprogress=100 then $xprogress=0
Sleep(30)
GUICtrlSetData($Progressbar, $xprogress)
WEnd

This causes an endless loop. You have to check for other conditions then ProcessExists to end loop / function.

Since i don't know what your progress.exe is doing, you have to solve the problem by yourself.

It seems you are doing an export, so you might check with FileExists or FileGetSize the condition of your export.

If your export is coded by yourself, a solution could be, writing a file, e.g. export.done, after export and check in your WaitExecuteShowProcess if the file exists and delete it then and exit loop.

;-))

Stefan

Share this post


Link to post
Share on other sites
lafafmentvotre

Ok

I change my condition and idea.

Thanks for reply

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.