Jump to content

A little help with exitloop


Gtek
 Share

Recommended Posts

Hi you all

Help :)

can get GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") to work.

I have tryed if GUISetOnEvent = $GUI_EVENT_CLOSE then exitloop. but noooo

 it will not stop it if i push the X or alt F4.

billede.png.18726457c40ea13e6d13e4bd33f374e0.png

it probably easy but over may level of understanding :)

Thanks in advance ;)

 

Func B_OK()
   local $slp = (GUICtrlRead($Input_5)*60)
   local $idtime = GUICtrlRead($Input_5)
   local $idTEXT1 = GUICtrlRead($Input_2)
   local $idTEXT2 = GUICtrlRead($Input_3)
   local $idTEXT3 = GUICtrlRead($Input_4)
   local $idlabel_1 = GUICtrlRead($label_1)

             GUIDelete($Parent1)
               Run(@ComSpec & " /C " & 'C:\Progra~1\Fineman\RsTcpCommand\RsTcpCommand 10.0.1.80 7898 "{ \"GROUP\" : \"GROUP1\", \"KEY\" : \"VALUE1\", \"VALUE\" : \"DROP-IN - SYNUNDERSÖKNING                               IDAG lediga tider:\",\"ACTION\" : \"QUEUEING_SET\" }"', "",@SW_HIDE )
               Run(@ComSpec & " /C " & 'C:\Progra~1\Fineman\RsTcpCommand\RsTcpCommand 10.0.1.80 7898 "{ \"GROUP\" : \"GROUP2\", \"KEY\" : \"VALUE2\", \"VALUE\" : \"'& $idtext1 &' - '& $idtext2 &' - '& $idtext3 &'\",\"ACTION\" : \"QUEUEING_SET\" }"',"",@SW_HIDE )

    local $parent2 = GUICreate("Meddelandet är aktivt på skärm", 350, 150)

    GuiCtrlCreateLabel("Fasadmeddelande slutar om "& $idtime &" minuter.", 30, 10, 250, 20)
    GuiCtrlCreateLabel("Om du vill avbryta fasadmeddelande nu, tryck ESC", 30, 30, 270, 20)
    GuiCtrlCreateLabel(""& $idtext1 &" - "& $idtext2 &" - "& $idtext3 &"", 20, 60, 200, 20, $SS_RIGHT)
    GuiCtrlCreateLabel("Annars försvinner denna popup-ruta automatisk om:", 50, 80, 300, 20)

    GUIDelete($Parent1)
    GUISetState(@SW_SHOW, $parent2)

$aTimeLeft = _TimeConvert($Slp)
While $Slp
   If TimerDiff($hTimer) >= 1000 Then
        $aTimeLeft = _TimeConvert($Slp)
        $slp -= 1
        GuiCtrlCreateLabel("Hours: " & $aTimeLeft[1] & "   Minutes: " & $aTimeLeft[2] & "   Seconds: " & $aTimeLeft[3], 100, 100, 300, 20)
        ;_GUIToolTip_SetTipBkColor($hWnd,0x000000)
        $hTimer = TimerInit()
    EndIf
 WEnd
         Run(@ComSpec & " /C " & 'C:\Progra~1\Fineman\RsTcpCommand\RsTcpCommand 10.0.1.80 7898 "{ \"GROUP\" : \"GROUP1\", \"KEY\" : \"VALUE1\", \"VALUE\" : \"\",\"ACTION\" : \"QUEUEING_SET\" }"',"",@SW_HIDE )
         Run(@ComSpec & " /C " & 'C:\Progra~1\Fineman\RsTcpCommand\RsTcpCommand 10.0.1.80 7898 "{ \"GROUP\" : \"GROUP2\", \"KEY\" : \"VALUE2\", \"VALUE\" : \"\",\"ACTION\" : \"QUEUEING_SET\" }"',"",@SW_HIDE )
Exit
 EndFunc

 

Link to comment
Share on other sites

Use HotKeySet to Exit or change a variable so it will exit the loop. Basic example, pressing Esc key will exit the loop

HotKeySet("{ESC}", "_ExitLoop")

Global $g_bExitLoop = False
While 1
    Sleep(100)
    If $g_bExitLoop Then ExitLoop
WEnd
MsgBox(4096, "Exit", "Loop Exited.")

Func _ExitLoop()
    $g_bExitLoop = True
EndFunc

 

Edited by Subz
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...