Jump to content

gui- / loop-problem


Recommended Posts

hi all!

got another problem with my script (see below)

the first loop works just fine - but if the second loop finishes, the "start/stop" button does not work anymore

when i click it, it starts another loop, instead of stopping it - and the deactivated stats for uploading and printing process does not work too..

i hope the few german sentances are not disturbing

thx for anyone who can help me, or atleast try to :)

#include <GuiConstants.au3>

#region start-gui
$gui_start = GuiCreate("Quotenlisten-TOOL",166,73,-1,-1,$WS_POPUPWINDOW)
WinSetOnTop("Quotenlisten-TOOL","",1)

GuiCtrlCreateLabel("Quotenlisten-Tool starten?", 18, 11, 130, 20)
$b_ja   = GuiCtrlCreateButton("Ja", 14, 40, 60, 20)
$b_nein = GuiCtrlCreateButton("Nein", 91, 40, 60, 20)
GuiSetState()
#endregion end start-gui


#region haupt-gui
$gui_haupt = GUICreate("Quotenlisten-TOOL", 297, 230, -1, -1,-1,$WS_EX_APPWINDOW,$gui_start)
GUICtrlCreateLabel("Quotenlisten alle", 5, 14, 80, 20)
$i_mins = GUICtrlCreateInput("10", 90, 11, 50, 20, $ES_NUMBER)
GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1,9999,10)
GUICtrlCreateLabel("Minuten drucken und uploaden", 143, 16, 161, 17)

$b_start = GUICtrlCreateButton("START", 110, 40, 70, 20)

$infotext = GUICtrlCreateLabel("                    (im stop-modus)", 50, 70, 220, 20)

$pr_print = GuiCtrlCreateProgress(75, 90, 190, 10, $PBS_SMOOTH)
$pr_up    = GuiCtrlCreateProgress(75, 103, 190, 10, $PBS_SMOOTH)
GuiCtrlCreateLabel("print-status", 20, 88, 52, 15)
GuiCtrlCreateLabel("upload-status", 9, 101, 64, 15)
$printprozent = GuiCtrlCreateLabel("0%", 266, 88, 40, 15)
$upprozent = GuiCtrlCreateLabel("0%", 266, 101, 40, 15)

$ed_status = GUICtrlCreateEdit("", 10, 120, 277, 100,$ES_READONLY)
#endregion haupt-gui ende


#region stop?-gui
$gui_stop = GuiCreate("ERROR #1337",120,80,-1, -1,$WS_DLGFRAME,-1,$gui_haupt)
WinSetOnTop("ERROR #1337","",1)
GuiCtrlCreateLabel("Bitte zuerst stoppen!", 15, 9, 130, 20)
$b_ok1   = GuiCtrlCreateButton("ok", 30, 33, 60, 20)
#endregion end stop?-gui

#region mindestwert-gui
$gui_mindest = GuiCreate("ERROR #123",120,80,-1, -1,$WS_DLGFRAME,-1,$gui_haupt)
WinSetOnTop("ERROR #123","",1)
GuiCtrlCreateLabel("Mindestwert: 10", 15, 9, 130, 20)
$b_ok2   = GuiCtrlCreateButton("ok", 30, 33, 60, 20)
#endregion end mindestwert-gui


While 1
    $msg = GuiGetMsg(1)
    Switch $msg[0]
        Case $b_nein
            Exit
        Case $b_ja
            GuiSetState()
            GUISetState(@SW_HIDE,$gui_start)
            GUISetState(@SW_HIDE,$gui_stop)
            GUISetState(@SW_HIDE,$gui_mindest)
            GUISetState(@SW_SHOW,$gui_haupt)
        Case $b_start
            If GUICtrlRead($b_start) = "START"  Then
                startmodus()
            Else
                stopmodus()
            EndIf
        Case $b_ok1
            GUISetState(@SW_HIDE,$gui_stop)
            GUISetState(@SW_RESTORE,$gui_haupt)
            GUISetState(@SW_ENABLE,$gui_haupt)
        Case $b_ok2
            GUISetState(@SW_HIDE,$gui_mindest)
            GUISetState(@SW_RESTORE,$gui_haupt)
            GUISetState(@SW_ENABLE,$gui_haupt)
        Case $GUi_EVENT_CLOSE
            If GUICtrlRead($b_start) = "stop"  Then
                GUISetState(@SW_SHOW,$gui_stop)
                GUISetState(@SW_RESTORE,$gui_stop)
                GUISetState(@SW_DISABLE,$gui_haupt)
            Else
                undtschuess()
            EndIf
    EndSwitch
WEnd
Exit



Func stopmodus()
    GUICtrlSetState($i_mins, $GUI_ENABLE)
    GUICtrlSetData($b_start, "START")
    GUICtrlSetData($infotext, "                    (im stop-modus)")
    GUICtrlSetData($printprozent, "0%")
    GUICtrlSetData($pr_print, "0")
    GUICtrlSetData($upprozent, "0%")
    GUICtrlSetData($pr_up, "0")
EndFunc

Func startmodus()
    $mintimer = GUICtrlRead($i_mins)
    If $mintimer <= 9 Then
        GUICtrlSetData($i_mins, 10)
        $mintimer = 10
        
        GUISetState(@SW_DISABLE,$gui_haupt)
        GUISetState(@SW_RESTORE,$gui_mindest)       
        GUISetState(@SW_SHOW,$gui_mindest)
    Else
        GUICtrlSetData($b_start, "stop")
        GUICtrlSetData($printprozent, "0%")
        GUICtrlSetData($pr_print, "0")
        GUICtrlSetData($upprozent, "0%")
        GUICtrlSetData($pr_up, "0")
        GUISetState(@SW_DISABLE, $gui_haupt)
        GUICtrlSetState($i_mins, $GUI_DISABLE)
        printupdate()       
        
    EndIf
EndFunc

Func printupdate()
    $printprogresstimer = GUICtrlRead($pr_print)
    GUICtrlSetData($infotext, "                          printing")
    GUISetState(@SW_DISABLE, $b_start)
    While $printprogresstimer < 100
        Sleep(1)
        $printprogresstimer += 1
        GUICtrlSetData($b_start, "printing")
        GUICtrlSetData($pr_print, $printprogresstimer)
        GUICtrlSetData($printprozent, $printprogresstimer & "%")
    WEnd
    If $printprogresstimer = 100 Then uploadupdate()
EndFunc

Func uploadupdate()
    $upprogresstimer = GUICtrlRead($pr_up)
    GUICtrlSetData($infotext, "                        uploading")
    While $upprogresstimer < 100
        Sleep(1)
        $upprogresstimer += 1
        GUICtrlSetData($b_start, "uploading")
        GUICtrlSetData($pr_up, $upprogresstimer)
        GUICtrlSetData($upprozent, $upprogresstimer & "%")
    WEnd
    if $upprogresstimer = 100 Then 
        GUICtrlSetData($b_start, "stop")
        GUICtrlSetState($b_start, $GUI_ENABLE)
        GUISetState(@SW_ENABLE, $gui_haupt)
        GUISetState(@SW_ENABLE, $b_start)
        timer($i_mins)
    EndIf
EndFunc

Func timer($label)
$label = GUICtrlRead($i_mins)
Local $time = TimerInit()
While 1
    $nMsg = GUIGetMsg(1)
    Switch $nMsg[0]
        Case $GUi_EVENT_CLOSE
            GUISetState(@SW_SHOW,$gui_stop)
            GUISetState(@SW_RESTORE,$gui_stop)
            GUISetState(@SW_DISABLE,$gui_haupt)
        Case $b_ok1
            GUISetState(@SW_HIDE,$gui_stop)
            GUISetState(@SW_RESTORE,$gui_haupt)
            GUISetState(@SW_ENABLE,$gui_haupt)
    EndSwitch
    $new = ($label * 1000) - TimerDiff($time)
    $seconds = Round($new / 1000)
    $newMin = Floor($seconds / 60)
    $newSec = Mod($seconds, 60)
    If $newSec < 10 Then $newSec = "0" & $newSec
    If $newMin < 10 Then $newMin = "0" & $newMin
    If ($newMin > 0 Or Number($newSec) > 0) Then
        Sleep(30)
        GUICtrlSetData($infotext, "nächster druck/upload in " & $newMin & " Min " & $newSec & " Sek")
        If GUIGetMsg() = $b_start Then
            stopmodus()
            ExitLoop
        EndIf
    ElseIf $newSec = 0 Then
        GUICtrlSetData($printprozent, "0%")
        GUICtrlSetData($pr_print, "0")
        GUICtrlSetData($upprozent, "0%")
        GUICtrlSetData($pr_up, "0")
        printupdate()
        Sleep(30)
    EndIf
WEnd
EndFunc 

Func undtschuess()
    WinSetOnTop("Quotenlisten-TOOL","",2)
    MsgBox(64, "thx for using blub-products", "©2007 - xxx", 2)
    WinSetOnTop("thx for using blub-products","",1)
    Exit
EndFunc

ps.: its not an error, that the input is not in minutes ;)

Edited by derblub
Link to comment
Share on other sites

Well I tried it and it seems to work.. I click start and it starts doing something. Then, the button changes to 'Stop'. I press it and it stops. The button changes to start again and I could go on like that for eternity. So.. I don't know...

Link to comment
Share on other sites

yeah - the first "loop" just works fine - but if you wait, till the counter counts to zero, and wait for the second loops, you will see, that the buttons get not deactivated anymore, and instead of stoping it, it starts a new loop

Link to comment
Share on other sites

Personally I don't like to run loops inside of loops. I would prefer to use the one main loop to handle it all. But following your code I see that you enter a second timer loop then if the timer runs out the different functions will start again. However it never exits the loop for the timer. By moving the printer call outside the loop and exiting (also required the stop to not be an exitloop ) it seems to work.

Cheers

#include <GuiConstants.au3>

#region start-gui
$gui_start = GuiCreate("Quotenlisten-TOOL",166,73,-1,-1,$WS_POPUPWINDOW)
WinSetOnTop("Quotenlisten-TOOL","",1)

GuiCtrlCreateLabel("Quotenlisten-Tool starten?", 18, 11, 130, 20)
$b_ja   = GuiCtrlCreateButton("Ja", 14, 40, 60, 20)
$b_nein = GuiCtrlCreateButton("Nein", 91, 40, 60, 20)
GuiSetState()
#endregion end start-gui


#region haupt-gui
$gui_haupt = GUICreate("Quotenlisten-TOOL", 297, 230, -1, -1,-1,$WS_EX_APPWINDOW,$gui_start)
GUICtrlCreateLabel("Quotenlisten alle", 5, 14, 80, 20)
$i_mins = GUICtrlCreateInput("10", 90, 11, 50, 20, $ES_NUMBER)
GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1,9999,10)
GUICtrlCreateLabel("Minuten drucken und uploaden", 143, 16, 161, 17)

$b_start = GUICtrlCreateButton("START", 110, 40, 70, 20)

$infotext = GUICtrlCreateLabel("                    (im stop-modus)", 50, 70, 220, 20)

$pr_print = GuiCtrlCreateProgress(75, 90, 190, 10, $PBS_SMOOTH)
$pr_up    = GuiCtrlCreateProgress(75, 103, 190, 10, $PBS_SMOOTH)
GuiCtrlCreateLabel("print-status", 20, 88, 52, 15)
GuiCtrlCreateLabel("upload-status", 9, 101, 64, 15)
$printprozent = GuiCtrlCreateLabel("0%", 266, 88, 40, 15)
$upprozent = GuiCtrlCreateLabel("0%", 266, 101, 40, 15)

$ed_status = GUICtrlCreateEdit("", 10, 120, 277, 100,$ES_READONLY)
#endregion haupt-gui ende


#region stop?-gui
$gui_stop = GuiCreate("ERROR #1337",120,80,-1, -1,$WS_DLGFRAME,-1,$gui_haupt)
WinSetOnTop("ERROR #1337","",1)
GuiCtrlCreateLabel("Bitte zuerst stoppen!", 15, 9, 130, 20)
$b_ok1   = GuiCtrlCreateButton("ok", 30, 33, 60, 20)
#endregion end stop?-gui

#region mindestwert-gui
$gui_mindest = GuiCreate("ERROR #123",120,80,-1, -1,$WS_DLGFRAME,-1,$gui_haupt)
WinSetOnTop("ERROR #123","",1)
GuiCtrlCreateLabel("Mindestwert: 10", 15, 9, 130, 20)
$b_ok2   = GuiCtrlCreateButton("ok", 30, 33, 60, 20)
#endregion end mindestwert-gui


While 1
    $msg = GuiGetMsg(1)
    Switch $msg[0]
        Case $b_nein
            Exit
        Case $b_ja
            GuiSetState()
            GUISetState(@SW_HIDE,$gui_start)
            GUISetState(@SW_HIDE,$gui_stop)
            GUISetState(@SW_HIDE,$gui_mindest)
            GUISetState(@SW_SHOW,$gui_haupt)
        Case $b_start
            If GUICtrlRead($b_start) = "START"  Then
                startmodus()
            Else
                stopmodus()
            EndIf
        Case $b_ok1
            GUISetState(@SW_HIDE,$gui_stop)
            GUISetState(@SW_RESTORE,$gui_haupt)
            GUISetState(@SW_ENABLE,$gui_haupt)
        Case $b_ok2
            GUISetState(@SW_HIDE,$gui_mindest)
            GUISetState(@SW_RESTORE,$gui_haupt)
            GUISetState(@SW_ENABLE,$gui_haupt)
        Case $GUi_EVENT_CLOSE
            If GUICtrlRead($b_start) = "stop"  Then
                GUISetState(@SW_SHOW,$gui_stop)
                GUISetState(@SW_RESTORE,$gui_stop)
                GUISetState(@SW_DISABLE,$gui_haupt)
            Else
                undtschuess()
            EndIf
    EndSwitch
WEnd
Exit



Func stopmodus()
    GUICtrlSetState($i_mins, $GUI_ENABLE)
    GUICtrlSetData($b_start, "START")
    GUICtrlSetData($infotext, "                    (im stop-modus)")
    GUICtrlSetData($printprozent, "0%")
    GUICtrlSetData($pr_print, "0")
    GUICtrlSetData($upprozent, "0%")
    GUICtrlSetData($pr_up, "0")
EndFunc

Func startmodus()
    $mintimer = GUICtrlRead($i_mins)
    If $mintimer <= 9 Then
        GUICtrlSetData($i_mins, 10)
        $mintimer = 10
       
        GUISetState(@SW_DISABLE,$gui_haupt)
        GUISetState(@SW_RESTORE,$gui_mindest)      
        GUISetState(@SW_SHOW,$gui_mindest)
    Else
        GUICtrlSetData($b_start, "stop")
        GUICtrlSetData($printprozent, "0%")
        GUICtrlSetData($pr_print, "0")
        GUICtrlSetData($upprozent, "0%")
        GUICtrlSetData($pr_up, "0")
        GUISetState(@SW_DISABLE, $gui_haupt)
        GUICtrlSetState($i_mins, $GUI_DISABLE)
        printupdate()      
       
    EndIf
EndFunc

Func printupdate()
    $printprogresstimer = GUICtrlRead($pr_print)
    GUICtrlSetData($infotext, "                          printing")
    GUISetState(@SW_DISABLE, $b_start)
    While $printprogresstimer < 100
        Sleep(1)
        $printprogresstimer += 1
        GUICtrlSetData($b_start, "printing")
        GUICtrlSetData($pr_print, $printprogresstimer)
        GUICtrlSetData($printprozent, $printprogresstimer & "%")
    WEnd
    If $printprogresstimer = 100 Then uploadupdate()
EndFunc

Func uploadupdate()
    $upprogresstimer = GUICtrlRead($pr_up)
    GUICtrlSetData($infotext, "                        uploading")
    While $upprogresstimer < 100
        Sleep(1)
        $upprogresstimer += 1
        GUICtrlSetData($b_start, "uploading")
        GUICtrlSetData($pr_up, $upprogresstimer)
        GUICtrlSetData($upprozent, $upprogresstimer & "%")
    WEnd
    if $upprogresstimer = 100 Then
        GUICtrlSetData($b_start, "stop")
        GUICtrlSetState($b_start, $GUI_ENABLE)
        GUISetState(@SW_ENABLE, $gui_haupt)
        GUISetState(@SW_ENABLE, $b_start)
        timer($i_mins)
    EndIf
EndFunc

Func timer($label)
$label = GUICtrlRead($i_mins)
Local $time = TimerInit()
While 1
    $nMsg = GUIGetMsg(1)
    Switch $nMsg[0]
        Case $GUi_EVENT_CLOSE
            GUISetState(@SW_SHOW,$gui_stop)
            GUISetState(@SW_RESTORE,$gui_stop)
            GUISetState(@SW_DISABLE,$gui_haupt)
        Case $b_ok1
            GUISetState(@SW_HIDE,$gui_stop)
            GUISetState(@SW_RESTORE,$gui_haupt)
            GUISetState(@SW_ENABLE,$gui_haupt)
    EndSwitch
    $new = ($label * 1000) - TimerDiff($time)
    $seconds = Round($new / 1000)
    $newMin = Floor($seconds / 60)
    $newSec = Mod($seconds, 60)
    If $newSec < 10 Then $newSec = "0" & $newSec
    If $newMin < 10 Then $newMin = "0" & $newMin
    If ($newMin > 0 Or Number($newSec) > 0) Then
        Sleep(30)
        GUICtrlSetData($infotext, "nächster druck/upload in " & $newMin & " Min " & $newSec & " Sek")
        If GUIGetMsg() = $b_start Then
            stopmodus()
            ;ExitLoop
            Return
        EndIf
    ElseIf $newSec = 0 Then
        GUICtrlSetData($printprozent, "0%")
        GUICtrlSetData($pr_print, "0")
        GUICtrlSetData($upprozent, "0%")
        GUICtrlSetData($pr_up, "0")
        ;printupdate()
        ExitLoop
        Sleep(30)
    EndIf
WEnd
printupdate()

EndFunc

Func undtschuess()
    WinSetOnTop("Quotenlisten-TOOL","",2)
    MsgBox(64, "thx for using blub-products", "©2007 - xxx", 2)
    WinSetOnTop("thx for using blub-products","",1)
    Exit
EndFunc
Link to comment
Share on other sites

well.. you are my hero!!

but youre right.. i have to clean up all those messed up loops a bit now - that should make it a little bit more easier for me :)

many thanks for your help!- now i got it!

but one thing that i still dont understand, is - why does the disabled state dont remain after the second loop on the print/upload buttons?

Edited by derblub
Link to comment
Share on other sites

Wrong command.... (see arrows below)

#include <GuiConstants.au3>

#region start-gui
$gui_start = GuiCreate("Quotenlisten-TOOL",166,73,-1,-1,$WS_POPUPWINDOW)
WinSetOnTop("Quotenlisten-TOOL","",1)

GuiCtrlCreateLabel("Quotenlisten-Tool starten?", 18, 11, 130, 20)
$b_ja   = GuiCtrlCreateButton("Ja", 14, 40, 60, 20)
$b_nein = GuiCtrlCreateButton("Nein", 91, 40, 60, 20)
GuiSetState()
#endregion end start-gui


#region haupt-gui
$gui_haupt = GUICreate("Quotenlisten-TOOL", 297, 230, -1, -1,-1,$WS_EX_APPWINDOW,$gui_start)
GUICtrlCreateLabel("Quotenlisten alle", 5, 14, 80, 20)
$i_mins = GUICtrlCreateInput("10", 90, 11, 50, 20, $ES_NUMBER)
GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1,9999,10)
GUICtrlCreateLabel("Minuten drucken und uploaden", 143, 16, 161, 17)

$b_start = GUICtrlCreateButton("START", 110, 40, 70, 20)

$infotext = GUICtrlCreateLabel("                    (im stop-modus)", 50, 70, 220, 20)

$pr_print = GuiCtrlCreateProgress(75, 90, 190, 10, $PBS_SMOOTH)
$pr_up    = GuiCtrlCreateProgress(75, 103, 190, 10, $PBS_SMOOTH)
GuiCtrlCreateLabel("print-status", 20, 88, 52, 15)
GuiCtrlCreateLabel("upload-status", 9, 101, 64, 15)
$printprozent = GuiCtrlCreateLabel("0%", 266, 88, 40, 15)
$upprozent = GuiCtrlCreateLabel("0%", 266, 101, 40, 15)

$ed_status = GUICtrlCreateEdit("", 10, 120, 277, 100,$ES_READONLY)
#endregion haupt-gui ende


#region stop?-gui
$gui_stop = GuiCreate("ERROR #1337",120,80,-1, -1,$WS_DLGFRAME,-1,$gui_haupt)
WinSetOnTop("ERROR #1337","",1)
GuiCtrlCreateLabel("Bitte zuerst stoppen!", 15, 9, 130, 20)
$b_ok1   = GuiCtrlCreateButton("ok", 30, 33, 60, 20)
#endregion end stop?-gui

#region mindestwert-gui
$gui_mindest = GuiCreate("ERROR #123",120,80,-1, -1,$WS_DLGFRAME,-1,$gui_haupt)
WinSetOnTop("ERROR #123","",1)
GuiCtrlCreateLabel("Mindestwert: 10", 15, 9, 130, 20)
$b_ok2   = GuiCtrlCreateButton("ok", 30, 33, 60, 20)
#endregion end mindestwert-gui


While 1
    $msg = GuiGetMsg(1)
    Switch $msg[0]
        Case $b_nein
            Exit
        Case $b_ja
            GuiSetState()
            GUISetState(@SW_HIDE,$gui_start)
            GUISetState(@SW_HIDE,$gui_stop)
            GUISetState(@SW_HIDE,$gui_mindest)
            GUISetState(@SW_SHOW,$gui_haupt)
        Case $b_start
            If GUICtrlRead($b_start) = "START"  Then
                startmodus()
            Else
                stopmodus()
            EndIf
        Case $b_ok1
            GUISetState(@SW_HIDE,$gui_stop)
            GUISetState(@SW_RESTORE,$gui_haupt)
            GUISetState(@SW_ENABLE,$gui_haupt)
        Case $b_ok2
            GUISetState(@SW_HIDE,$gui_mindest)
            GUISetState(@SW_RESTORE,$gui_haupt)
            GUISetState(@SW_ENABLE,$gui_haupt)
        Case $GUi_EVENT_CLOSE
            If GUICtrlRead($b_start) = "stop"  Then
                GUISetState(@SW_SHOW,$gui_stop)
                GUISetState(@SW_RESTORE,$gui_stop)
                GUISetState(@SW_DISABLE,$gui_haupt)
            Else
                undtschuess()
            EndIf
    EndSwitch
WEnd
Exit



Func stopmodus()
    GUICtrlSetState($i_mins, $GUI_ENABLE)
    GUICtrlSetData($b_start, "START")
    GUICtrlSetData($infotext, "                    (im stop-modus)")
    GUICtrlSetData($printprozent, "0%")
    GUICtrlSetData($pr_print, "0")
    GUICtrlSetData($upprozent, "0%")
    GUICtrlSetData($pr_up, "0")
EndFunc

Func startmodus()
    $mintimer = GUICtrlRead($i_mins)
    If $mintimer <= 9 Then
        GUICtrlSetData($i_mins, 10)
        $mintimer = 10
       
        GUISetState(@SW_DISABLE,$gui_haupt)
        GUISetState(@SW_RESTORE,$gui_mindest)      
        GUISetState(@SW_SHOW,$gui_mindest)
    Else
        GUICtrlSetData($b_start, "stop")
        GUICtrlSetData($printprozent, "0%")
        GUICtrlSetData($pr_print, "0")
        GUICtrlSetData($upprozent, "0%")
        GUICtrlSetData($pr_up, "0")
        GUISetState(@SW_DISABLE, $gui_haupt)
        GUICtrlSetState($i_mins, $GUI_DISABLE)
        printupdate()      
       
    EndIf
EndFunc

Func printupdate()
    $printprogresstimer = GUICtrlRead($pr_print)
    GUICtrlSetData($infotext, "                          printing")
    GUICtrlSetState($b_start,$GUI_DISABLE);<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ;GUISetState(@SW_DISABLE, $b_start)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    While $printprogresstimer < 100
        Sleep(1)
        $printprogresstimer += 1
        GUICtrlSetData($b_start, "printing")
        GUICtrlSetData($pr_print, $printprogresstimer)
        GUICtrlSetData($printprozent, $printprogresstimer & "%")
    WEnd
    If $printprogresstimer = 100 Then uploadupdate()
EndFunc

Func uploadupdate()
    $upprogresstimer = GUICtrlRead($pr_up)
    GUICtrlSetData($infotext, "                        uploading")
    While $upprogresstimer < 100
        Sleep(1)
        $upprogresstimer += 1
        GUICtrlSetData($b_start, "uploading")
        GUICtrlSetData($pr_up, $upprogresstimer)
        GUICtrlSetData($upprozent, $upprogresstimer & "%")
    WEnd
    if $upprogresstimer = 100 Then
        GUICtrlSetData($b_start, "stop")
        GUICtrlSetState($b_start, $GUI_ENABLE)
        GUISetState(@SW_ENABLE, $gui_haupt)
        GUISetState(@SW_ENABLE, $b_start)
        timer($i_mins)
    EndIf
EndFunc

Func timer($label)
$label = GUICtrlRead($i_mins)
Local $time = TimerInit()
While 1
    $nMsg = GUIGetMsg(1)
    Switch $nMsg[0]
        Case $GUi_EVENT_CLOSE
            GUISetState(@SW_SHOW,$gui_stop)
            GUISetState(@SW_RESTORE,$gui_stop)
            GUISetState(@SW_DISABLE,$gui_haupt)
        Case $b_ok1
            GUISetState(@SW_HIDE,$gui_stop)
            GUISetState(@SW_RESTORE,$gui_haupt)
            GUISetState(@SW_ENABLE,$gui_haupt)
    EndSwitch
    $new = ($label * 1000) - TimerDiff($time)
    $seconds = Round($new / 1000)
    $newMin = Floor($seconds / 60)
    $newSec = Mod($seconds, 60)
    If $newSec < 10 Then $newSec = "0" & $newSec
    If $newMin < 10 Then $newMin = "0" & $newMin
    If ($newMin > 0 Or Number($newSec) > 0) Then
        Sleep(30)
        GUICtrlSetData($infotext, "nächster druck/upload in " & $newMin & " Min " & $newSec & " Sek")
        If GUIGetMsg() = $b_start Then
            stopmodus()
            ;ExitLoop
            Return
        EndIf
    ElseIf $newSec = 0 Then
        GUICtrlSetData($printprozent, "0%")
        GUICtrlSetData($pr_print, "0")
        GUICtrlSetData($upprozent, "0%")
        GUICtrlSetData($pr_up, "0")
        ;printupdate()
        ;stopmodus()
        ExitLoop
        Sleep(30)
    EndIf
WEnd
printupdate()

EndFunc

Func undtschuess()
    WinSetOnTop("Quotenlisten-TOOL","",2)
    MsgBox(64, "thx for using blub-products", "©2007 - xxx", 2)
    WinSetOnTop("thx for using blub-products","",1)
    Exit
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...