Jump to content

Select Case issue


Recommended Posts

Here's my script:

#include <GUIConstants.au3>
#include <Date.au3>
#include <Math.au3>

Opt("GUIOnEventMode", 1)
Opt("TrayMenuMode", 1)

Global $bBreak

$Form1 = GUICreate("Ogame Tool", 270, 176)
;~ GuiSetIcon("E:\De pe hardul vechi\-------- FOLDER CRISTI --------\My docs\My Documents\ObjectDock Library", 0)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Tab1 = GUICtrlCreateTab(0, 0, 269, 175)
GUICtrlSetResizing($Tab1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)



$TabSheet2 = GUICtrlCreateTabItem("Cronometru")
$Input4 = GUICtrlCreateInput("", 16, 72, 57, 21)
$Input5 = GUICtrlCreateInput("", 104, 72, 57, 21)
$Input6 = GUICtrlCreateInput("", 192, 72, 57, 21)
$Label4 = GUICtrlCreateLabel("Ore", 32, 48, 21, 17)
$Label5 = GUICtrlCreateLabel("Minute", 114, 48, 36, 17)
$Label6 = GUICtrlCreateLabel("Secunde", 197, 48, 47, 17)
$Button2 = GUICtrlCreateButton("Start !", 96, 136, 75, 25, 0)
GUICtrlSetOnEvent($Button2, "Button2Click")
$labelCredit2 = GUICtrlCreateLabel("Facut de: kiti_viermisor@yahoo.com", 90, 25)
GUICtrlSetColor($labelCredit2, 0xD4D0C8)
$labelhelp2 = GUICtrlCreateLabel("Ajutor!", 230, 157)
GUICtrlSetColor($labelhelp2, 0x0000FF)
GUICtrlSetOnEvent($labelhelp2, "Help2Click")

GUICtrlCreateTabItem("")

SoundPlay(@WindowsDir & "\media\notify.wav", 0)
GUISetState(@SW_SHOW)



$display = TrayCreateItem("Afisare")
TrayCreateItem("")
$exit = TrayCreateItem("Iesire")

TraySetState()
TraySetToolTip("Ogame Tool")
TraySetClick(16)

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $display
            GUISetState(@SW_SHOW, $Form1)
        Case $msg = $exit
            SoundPlay(@WindowsDir & "\media\notify.wav", 1)
            ExitLoop
    EndSelect
WEnd

Func Help1Click()

EndFunc   ;==>Help1Click

Func Help2Click()

EndFunc   ;==>Help2Click

Func Help3Click()

EndFunc   ;==>Help3Click

Func Help4Click()

EndFunc   ;==>Help4Click

Func HelpClose1()


EndFunc   ;==>HelpClose1

Func HelpClose2()

EndFunc   ;==>HelpClose2

Func HelpClose3()

EndFunc   ;==>HelpClose3

Func HelpClose4()

EndFunc   ;==>HelpClose4

Func Button8Click()

EndFunc   ;==>Button8Click

Func LambertW($x, $prec = 0.000000000001, $maxiters = 100)

EndFunc   ;==>LambertW

;==>Button5Click

Func Button1Click()

EndFunc   ;==>Button1Click

Func Button2Click()
    $h = GUICtrlRead($Input4)
    $m = GUICtrlRead($Input5)
    $s = GUICtrlRead($Input6)

    Local $StartTime = @HOUR & ":" & @MIN & ":" & @SEC
    If $bBreak Then Return
    $bBreak = Not $bBreak
    If $h = "" Then $h = 0
    If $m = "" Then $m = 0
    If $s = "" Then $s = 0
    Local $sEndTime = $h & ":" & $m & ":" & $s
    Local $sTimeBack = _StrAddSub(@HOUR & ":" & @MIN & ":" & @SEC, $sEndTime)
    Local $sSubTimeDiff, $sHMS

;HERE STARTS THE PROBLEM
    While $bBreak
        $sHMS = @HOUR & ":" & @MIN & ":" & @SEC
        $RunFor = _StrAddSub($sHMS, $StartTime, 0)
        $sSubTimeDiff = _StrAddSub($sTimeBack, $sHMS, 0)
        $pos = MouseGetPos()
        If $pos[0] = @DesktopWidth - 1 And $pos[1] = 0 Then
            ToolTip("Timp ramas: " & $sSubTimeDiff & @CRLF & _
                    "Timp trecut:" & $RunFor & @CRLF & _
                    "Data incepere: " & $StartTime & @CRLF & _
                    "Data terminare: " & $sTimeBack & @CRLF & _
                    "Durata: " & $sEndTime, 0, 0)
        Else
            ToolTip("")
        EndIf
        If $sHMS = $sTimeBack Then
            MsgBox(64, "", "Timpul s-a terminat! Constructia este gata!")
            GUISetState(@SW_SHOW)
            ExitLoop
        EndIf
        Sleep(1000)
    WEnd
    ToolTip("")
    $bBreak = False
    Return
EndFunc   ;==>Button2Click

Func Button3Click()

EndFunc   ;==>Button3Click

Func Button4Click()

EndFunc   ;==>Button4Click

Func Button5Click()

EndFunc   ;==>Button5Click

Func Button6Click()

EndFunc   ;==>Button6Click

Func Button7Click()

EndFunc   ;==>Button7Click


Func _StrAddSub($sTime1, $sTime2, $iAdd = 1, $sDelim = ':'); $iAdd = 1 Add, $iAdd = 0 Subtract
    Local $aSplit1 = StringSplit($sTime1, $sDelim), $iSubTotal = 0
    Local $aSplit2 = StringSplit($sTime2, $sDelim)
    If $aSplit1[0] <> 3 Or $aSplit2[0] <> 3 Then Return SetError(0, 0, 0)
    Local $iTotal1 = ((Int($aSplit1[1]) * 3600) + (Int($aSplit1[2]) * 60) + (Int($aSplit1[3])))
    Local $iTotal2 = ((Int($aSplit2[1]) * 3600) + (Int($aSplit2[2]) * 60) + (Int($aSplit2[3])))
    If $iAdd Then
        $iSubTotal = $iTotal1 + $iTotal2
    ElseIf $iTotal1 >= $iTotal2 Then
        $iSubTotal = $iTotal1 - $iTotal2
    Else
        $iSubTotal = $iTotal2 - $iTotal1
    EndIf
    Local $iHour = Int(($iSubTotal / 3600))
    Local $iMin = Int(($iSubTotal - ($iHour * 3600)) / 60)
    Local $iSec = Int(($iSubTotal - $iHour * 3600) - ($iMin * 60))
    Return StringFormat('%02d', $iHour) & $sDelim & StringFormat('%02d', $iMin) & $sDelim & StringFormat('%02d', $iSec)
EndFunc   ;==>_StrAddSub

Func getpart($NUM)
    
EndFunc   ;=>getpart

Func Form1Close()
    GUISetState(@SW_HIDE, $Form1)
    TrayTip("Ogame Tool", "Puteti reafisa programul de aici!", 5, 1)
    Sleep(2000)
    TrayTip("", "", 0)
EndFunc   ;==>Form1CloseoÝ÷ Øy©Ý²0!!úèØ^ªê-^«¨µ»­¶Ú×ë¢kazÚÚÊg§¸­Â§"ËZ¶Ø^rº'¢g­z¹è궬{l(®@'vØZ·lmçºÇ­çâ®Ëp)^)Ê/z»ZéÛÊØ^±ç(ÛayÊèµêèâ7ö÷­®'¶§µè+j×­çâ®ËbØ^±ç(Öî¶+]¡ë'ßÛp¢¹Ø^­«­¢+Ø$%M±Ð($$%
ÍÀÌØíÍ!5LôÀÌØíÍQ¥µ    ¬($$$%5Í  ½à ØаÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐíQ¥µÁհ̵Ñɵ¥¹ÐÌÌì
½¹ÍÑÉÕÑ¥ÍÑÑÌÌìÅÕ½Ðì¤($$$%U%MÑMÑÑ¡M]}M!=¤($$$%á¥Ñ1½½À($$%
ÍÀÌØíÁ½ÍlÁtôͭѽÁ]¥Ñ ´Ä¹ÀÌØíÁ½ÍlÅtôÀ($$$%Q½½±Q¥À ÅÕ½ÐíQ¥µÀɵÌèÅÕ½ÐìµÀìÀÌØíÍMÕQ¥µ¥µÀì
I1µÀì|($$$$$$ÅÕ½ÐíQ¥µÀÑÉÕÐèÅÕ½ÐìµÀìÀÌØíIÕ¹½ÈµÀì
I1µÀì|($$$$$$ÅÕ½ÐíÑ¥¹ÁÉèÅÕ½ÐìµÀìÀÌØíMÑÉÑQ¥µµÀì
I1µÀì|($$$$$$ÅÕ½ÐíÑÑɵ¥¹ÉèÅÕ½ÐìµÀìÀÌØíÍQ¥µ   ¬µÀì
I1µÀì|($$$$$$ÅÕ½ÐíÕÉÑèÅÕ½ÐìµÀìÀÌØí͹Q¥µ°À°À¤($$%
ÍÀÌØíÁ½ÍlÁt±ÐìÐìͭѽÁ]¥Ñ ´Ä¹ÀÌØíÁ½ÍlÅt±ÐìÐìÀ($$$%Q½½±Q¥À ÅÕ½ÐìÅÕ½Ðì¤($$%
ÍÀÌØíµÍôÀ($$$%
½¹Ñ¥¹Õ1½½À($$%
ÍÀÌØíµÍôÀÌØí¥ÍÁ±ä($$$%U%MÑMÑÑ¡M]}M!=°ÀÌØí½É´Ä¤($$%
ÍÀÌØíµÍôÀÌØíá¥Ð($$$%M½Õ¹A±ä¡]¥¹½ÝͥȵÀìÅÕ½ÐìÀäÈíµ¥ÀäÈí¹½Ñ¥ä¹ÝØÅÕ½Ðì°Ä¤($$$%á¥ÐÀ($%¹M±Ð($%M±À ÄÀÀÀ¤(%]¹

And that's because only the first correct case is executed, which is the third one. Do you have any ideea how can I solve this problem?

Link to comment
Share on other sites

It is never good to have a while loop inside a while loop, for this very reason. Because of this, you should definitely integrate the second one into the first, like you said above.

This didn't work for you initially because you were using 1 Select Case. To do what you're trying, have 2 select cases... one for the GUI events and one for the other function.

Regards,Josh

Link to comment
Share on other sites

It doesn't work either muttley

#include <GUIConstants.au3>
#include <Date.au3>
#include <Math.au3>

Opt("GUIOnEventMode", 1)
Opt("TrayMenuMode", 1)

Global $bBreak

$Form1 = GUICreate("Ogame Tool", 270, 176)
;~ GuiSetIcon("E:\De pe hardul vechi\-------- FOLDER CRISTI --------\My docs\My Documents\ObjectDock Library", 0)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Tab1 = GUICtrlCreateTab(0, 0, 269, 175)
GUICtrlSetResizing($Tab1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)



$TabSheet2 = GUICtrlCreateTabItem("Cronometru")
$Input4 = GUICtrlCreateInput("", 16, 72, 57, 21)
$Input5 = GUICtrlCreateInput("", 104, 72, 57, 21)
$Input6 = GUICtrlCreateInput("", 192, 72, 57, 21)
$Label4 = GUICtrlCreateLabel("Ore", 32, 48, 21, 17)
$Label5 = GUICtrlCreateLabel("Minute", 114, 48, 36, 17)
$Label6 = GUICtrlCreateLabel("Secunde", 197, 48, 47, 17)
$Button2 = GUICtrlCreateButton("Start !", 96, 136, 75, 25, 0)
GUICtrlSetOnEvent($Button2, "Button2Click")
$labelCredit2 = GUICtrlCreateLabel("Facut de: kiti_viermisor@yahoo.com", 90, 25)
GUICtrlSetColor($labelCredit2, 0xD4D0C8)
$labelhelp2 = GUICtrlCreateLabel("Ajutor!", 230, 157)
GUICtrlSetColor($labelhelp2, 0x0000FF)
GUICtrlSetOnEvent($labelhelp2, "Help2Click")

GUICtrlCreateTabItem("")

SoundPlay(@WindowsDir & "\media\notify.wav", 0)
GUISetState(@SW_SHOW)



$display = TrayCreateItem("Afisare")
TrayCreateItem("")
$exit = TrayCreateItem("Iesire")

TraySetState()
TraySetToolTip("Ogame Tool")
TraySetClick(16)

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $display
            GUISetState(@SW_SHOW, $Form1)
        Case $msg = $exit
            SoundPlay(@WindowsDir & "\media\notify.wav", 1)
            ExitLoop
    EndSelect
WEnd

Func Help1Click()

EndFunc   ;==>Help1Click

Func Help2Click()

EndFunc   ;==>Help2Click

Func Help3Click()

EndFunc   ;==>Help3Click

Func Help4Click()

EndFunc   ;==>Help4Click

Func HelpClose1()


EndFunc   ;==>HelpClose1

Func HelpClose2()

EndFunc   ;==>HelpClose2

Func HelpClose3()

EndFunc   ;==>HelpClose3

Func HelpClose4()

EndFunc   ;==>HelpClose4

Func Button8Click()

EndFunc   ;==>Button8Click

Func LambertW($x, $prec = 0.000000000001, $maxiters = 100)

EndFunc   ;==>LambertW

;==>Button5Click

Func Button1Click()

EndFunc   ;==>Button1Click

Func Button2Click()
    $h = GUICtrlRead($Input4)
    $m = GUICtrlRead($Input5)
    $s = GUICtrlRead($Input6)

    Local $StartTime = @HOUR & ":" & @MIN & ":" & @SEC
    If $bBreak Then Return
    $bBreak = Not $bBreak
    If $h = "" Then $h = 0
    If $m = "" Then $m = 0
    If $s = "" Then $s = 0
    Local $sEndTime = $h & ":" & $m & ":" & $s
    Local $sTimeBack = _StrAddSub(@HOUR & ":" & @MIN & ":" & @SEC, $sEndTime)
    Local $sSubTimeDiff, $sHMS


;------------------------------------------LOOK HERE!------------------------------------------
    While $bBreak
                $msg = TrayGetMsg()
        Select
            Case $msg = 0
                ; what to put here if I'm not in a While loop? :D
            Case $msg = $display
                GUISetState(@SW_SHOW, $Form1)
            Case $msg = $exit
                SoundPlay(@WindowsDir & "\media\notify.wav", 1)
                Exit 0
        EndSelect
        
        $sHMS = @HOUR & ":" & @MIN & ":" & @SEC
        $RunFor = _StrAddSub($sHMS, $StartTime, 0)
        $sSubTimeDiff = _StrAddSub($sTimeBack, $sHMS, 0)
        $pos = MouseGetPos()
        Select
            Case $pos[0] = @DesktopWidth - 1 And $pos[1] = 0
                ToolTip("Timp ramas: " & $sSubTimeDiff & @CRLF & _
                        "Timp trecut:" & $RunFor & @CRLF & _
                        "Data incepere: " & $StartTime & @CRLF & _
                        "Data terminare: " & $sTimeBack & @CRLF & _
                        "Durata: " & $sEndTime, 0, 0)
            Case $pos[0] <> @DesktopWidth - 1 And $pos[1] <> 0
                ToolTip("")
                
            Case $sHMS = $sTimeBack
                MsgBox(64, "", "Timpul s-a terminat! Constructia este gata!")
                GUISetState(@SW_SHOW)
                ExitLoop
        EndSelect

        Sleep(1000)
    WEnd
    ToolTip("")
    $bBreak = False
    Return
EndFunc   ;==>Button2Click

Func Button3Click()

EndFunc   ;==>Button3Click

Func Button4Click()

EndFunc   ;==>Button4Click

Func Button5Click()

EndFunc   ;==>Button5Click

Func Button6Click()

EndFunc   ;==>Button6Click

Func Button7Click()

EndFunc   ;==>Button7Click


Func _StrAddSub($sTime1, $sTime2, $iAdd = 1, $sDelim = ':'); $iAdd = 1 Add, $iAdd = 0 Subtract
    Local $aSplit1 = StringSplit($sTime1, $sDelim), $iSubTotal = 0
    Local $aSplit2 = StringSplit($sTime2, $sDelim)
    If $aSplit1[0] <> 3 Or $aSplit2[0] <> 3 Then Return SetError(0, 0, 0)
    Local $iTotal1 = ((Int($aSplit1[1]) * 3600) + (Int($aSplit1[2]) * 60) + (Int($aSplit1[3])))
    Local $iTotal2 = ((Int($aSplit2[1]) * 3600) + (Int($aSplit2[2]) * 60) + (Int($aSplit2[3])))
    If $iAdd Then
        $iSubTotal = $iTotal1 + $iTotal2
    ElseIf $iTotal1 >= $iTotal2 Then
        $iSubTotal = $iTotal1 - $iTotal2
    Else
        $iSubTotal = $iTotal2 - $iTotal1
    EndIf
    Local $iHour = Int(($iSubTotal / 3600))
    Local $iMin = Int(($iSubTotal - ($iHour * 3600)) / 60)
    Local $iSec = Int(($iSubTotal - $iHour * 3600) - ($iMin * 60))
    Return StringFormat('%02d', $iHour) & $sDelim & StringFormat('%02d', $iMin) & $sDelim & StringFormat('%02d', $iSec)
EndFunc   ;==>_StrAddSub

Func getpart($NUM)
   
EndFunc   ;=>getpart

Func Form1Close()
    GUISetState(@SW_HIDE, $Form1)
    TrayTip("Ogame Tool", "Puteti reafisa programul de aici!", 5, 1)
    Sleep(2000)
    TrayTip("", "", 0)
EndFunc   ;==>Form1Close

Edit: I've cut down the unecessary parts.

Edited by Kiti
Link to comment
Share on other sites

I would NOT use GUIOnEventMode, but I don't really have the time to rewrite your code, but here is something that would work.

I am not positive on what i is supposed to do, but this will loop through the code without nesting while loops. You'll need to tweak things, but here:

#include <GUIConstants.au3>
#include <Date.au3>
#include <Math.au3>

Opt("GUIOnEventMode", 1)
Opt("TrayMenuMode", 1)

Global $bBreak
Global $started
$Form1 = GUICreate("Ogame Tool", 270, 176)
;~ GuiSetIcon("E:\De pe hardul vechi\-------- FOLDER CRISTI --------\My docs\My Documents\ObjectDock Library", 0)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Tab1 = GUICtrlCreateTab(0, 0, 269, 175)
GUICtrlSetResizing($Tab1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)



$TabSheet2 = GUICtrlCreateTabItem("Cronometru")
$Input4 = GUICtrlCreateInput("", 16, 72, 57, 21)
$Input5 = GUICtrlCreateInput("", 104, 72, 57, 21)
$Input6 = GUICtrlCreateInput("", 192, 72, 57, 21)
$Label4 = GUICtrlCreateLabel("Ore", 32, 48, 21, 17)
$Label5 = GUICtrlCreateLabel("Minute", 114, 48, 36, 17)
$Label6 = GUICtrlCreateLabel("Secunde", 197, 48, 47, 17)
$Button2 = GUICtrlCreateButton("Start !", 96, 136, 75, 25, 0)
GUICtrlSetOnEvent($Button2, "Button2Click")
$labelCredit2 = GUICtrlCreateLabel("Facut de: kiti_viermisor@yahoo.com", 90, 25)
GUICtrlSetColor($labelCredit2, 0xD4D0C8)
$labelhelp2 = GUICtrlCreateLabel("Ajutor!", 230, 157)
GUICtrlSetColor($labelhelp2, 0x0000FF)
GUICtrlSetOnEvent($labelhelp2, "Help2Click")

GUICtrlCreateTabItem("")

SoundPlay(@WindowsDir & "\media\notify.wav", 0)
GUISetState(@SW_SHOW)



$display = TrayCreateItem("Afisare")
TrayCreateItem("")
$exit = TrayCreateItem("Iesire")

TraySetState()
TraySetToolTip("Ogame Tool")
TraySetClick(16)

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $display
            GUISetState(@SW_SHOW, $Form1)
        Case $msg = $exit
            SoundPlay(@WindowsDir & "\media\notify.wav", 1)
            ExitLoop
    EndSelect

    If $started = 1 Then Button2Click()
    
WEnd

Func Help1Click()

EndFunc  ;==>Help1Click

Func Help2Click()

EndFunc  ;==>Help2Click

Func Help3Click()

EndFunc  ;==>Help3Click

Func Help4Click()

EndFunc  ;==>Help4Click

Func HelpClose1()


EndFunc  ;==>HelpClose1

Func HelpClose2()

EndFunc  ;==>HelpClose2

Func HelpClose3()

EndFunc  ;==>HelpClose3

Func HelpClose4()

EndFunc  ;==>HelpClose4

Func Button8Click()

EndFunc  ;==>Button8Click

Func LambertW($x, $prec = 0.000000000001, $maxiters = 100)

EndFunc  ;==>LambertW

;==>Button5Click

Func Button1Click()

EndFunc  ;==>Button1Click

Func Button2Click()
    If $started = 0 Then
        $started = 1
        Return
    EndIf
    
    If $bBreak = False Then
        $h = GUICtrlRead($Input4)
        $m = GUICtrlRead($Input5)
        $s = GUICtrlRead($Input6)
    
        Global $StartTime = @HOUR & ":" & @MIN & ":" & @SEC
        If $bBreak Then Return
        $bBreak = Not $bBreak
        If $h = "" Then $h = 0
        If $m = "" Then $m = 0
        If $s = "" Then $s = 0
        Global $sEndTime = $h & ":" & $m & ":" & $s
        Global $sTimeBack = _StrAddSub(@HOUR & ":" & @MIN & ":" & @SEC, $sEndTime)
        Global $sSubTimeDiff, $sHMS
    ElseIf $bBreak Then
                $msg = TrayGetMsg()
        Select
            Case $msg = 0
               ; what to put here if I'm not in a While loop? biggrin.gif
            Case $msg = $display
                GUISetState(@SW_SHOW, $Form1)
            Case $msg = $exit
                SoundPlay(@WindowsDir & "\media\notify.wav", 1)
                Exit 0
        EndSelect
       
        $sHMS = @HOUR & ":" & @MIN & ":" & @SEC
        $RunFor = _StrAddSub($sHMS, $StartTime, 0)
        $sSubTimeDiff = _StrAddSub($sTimeBack, $sHMS, 0)
        $pos = MouseGetPos()
        Select
            Case $pos[0] = @DesktopWidth - 1 And $pos[1] = 0
                ToolTip("Timp ramas: " & $sSubTimeDiff & @CRLF & _
                        "Timp trecut:" & $RunFor & @CRLF & _
                        "Data incepere: " & $StartTime & @CRLF & _
                        "Data terminare: " & $sTimeBack & @CRLF & _
                        "Durata: " & $sEndTime, 0, 0)
            Case $pos[0] <> @DesktopWidth - 1 And $pos[1] <> 0
                ToolTip("")
               
            Case $sHMS = $sTimeBack
                MsgBox(64, "", "Timpul s-a terminat! Constructia este gata!")
                GUISetState(@SW_SHOW)
                $started = 0
                ToolTip("")
                $bBreak = False
        EndSelect

        Sleep(1000)
   EndIf
    
    Return
EndFunc  ;==>Button2Click

Func Button3Click()

EndFunc  ;==>Button3Click

Func Button4Click()

EndFunc  ;==>Button4Click

Func Button5Click()

EndFunc  ;==>Button5Click

Func Button6Click()

EndFunc  ;==>Button6Click

Func Button7Click()

EndFunc  ;==>Button7Click


Func _StrAddSub($sTime1, $sTime2, $iAdd = 1, $sDelim = ':'); $iAdd = 1 Add, $iAdd = 0 Subtract
    Local $aSplit1 = StringSplit($sTime1, $sDelim), $iSubTotal = 0
    Local $aSplit2 = StringSplit($sTime2, $sDelim)
    If $aSplit1[0] <> 3 Or $aSplit2[0] <> 3 Then Return SetError(0, 0, 0)
    Local $iTotal1 = ((Int($aSplit1[1]) * 3600) + (Int($aSplit1[2]) * 60) + (Int($aSplit1[3])))
    Local $iTotal2 = ((Int($aSplit2[1]) * 3600) + (Int($aSplit2[2]) * 60) + (Int($aSplit2[3])))
    If $iAdd Then
        $iSubTotal = $iTotal1 + $iTotal2
    ElseIf $iTotal1 >= $iTotal2 Then
        $iSubTotal = $iTotal1 - $iTotal2
    Else
        $iSubTotal = $iTotal2 - $iTotal1
    EndIf
    Local $iHour = Int(($iSubTotal / 3600))
    Local $iMin = Int(($iSubTotal - ($iHour * 3600)) / 60)
    Local $iSec = Int(($iSubTotal - $iHour * 3600) - ($iMin * 60))
    Return StringFormat('%02d', $iHour) & $sDelim & StringFormat('%02d', $iMin) & $sDelim & StringFormat('%02d', $iSec)
EndFunc  ;==>_StrAddSub

Func getpart($NUM)
   
EndFunc  ;=>getpart

Func Form1Close()
    GUISetState(@SW_HIDE, $Form1)
    TrayTip("Ogame Tool", "Puteti reafisa programul de aici!", 5, 1)
    Sleep(2000)
    TrayTip("", "", 0)
EndFunc  ;==>Form1Close

The new global variable $started is just a flag for whether or not it should run the code. Also because of this, I made your local variables from button2() global

Regards,Josh

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...