Jump to content

Exitloop using an hotkey


Recommended Posts

This code seems to work but it may be breaking more then it fixes... the point of it is to have your GUI loop enclosed in a function that you set a hotkey to when entering your loop... try this out but beyond what I said before thats all I can come up with...

#include <GuiConstants.au3>
#Include <Misc.au3>


Opt("TrayIconDebug", 1)

GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Loop = GuiCtrlCreateButton("Run Loop", 160, 260, 80, 40)
GuiCtrlCreateGroup("", 30, 20, 340, 230)

_MainGUI()

Func _MainGUI()
GuiSetState()
HotKeySet("{PAUSE}")
ToolTip("") ;clears the tooltip

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    EndSelect
    If $msg = $Loop Then _Looptime()
WEnd
EndFunc


Func _Looptime()
HotKeySet("{PAUSE}", "_MainGUI")
While 1
ToolTip("running loop", 0, 0)
    sleep(10) ; this is equal to a very big loop, I mean that this part represent +-1000 lines of script.
    Run("notepad")
    Sleep(500)
    Sleep(500)
    Sleep(500)
    Sleep(500)
    Sleep(500)
    Sleep(500)
    Sleep(500)
    WinClose("Untitled")
WEnd
MsgBox(0, "", "exiting loop function")
EndFunc

let us know if that works for you...

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
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...