Jump to content

GoToNextLine() - useful function I worte for easy debuging

Recommended Posts


The rule is simple, first you need set hotkey that when you  presses it, the code will continue to the next line with GoToNextLine_HotKeySet($Key)

the next step is to put the GoToNextLine() function on  every line you want to stop the executing process.


 I I've included an example + function:

GoToNextLine_HotKeySet('z') ; You need to set hotkey. You must call this function first on order to make it work!

Local $hGUI
; Create GUI
$hGUI = GUICreate("Test", 400, 300)
GoToNextLine() ; here I use it. the next line will not execute until you presses on z key (in this case)
GoToNextLine('Next line will change the color to red!') ; same story but here I added extra informition..
GoToNextLine('Next line will delete the GUI','The GUI was deleted "now"') ; same story but I added more info after...

GoToNextLine('In the next line I will do something else... presses z to continue.')
For $y = 0 To @DesktopHeight Step Int(@DesktopHeight*0.125)
    GoToNextLine('Now I going to next or first $y - '&$y&', and enter into the $y loop...')
    For $x = 0 To @DesktopWidth Step Int(@DesktopHeight*0.25)
    GoToNextLine('$y loop ended. are you sure you want to continue to the next loop or line? presses z to continue.')

Func GoToNextLine_HotKeySet($Key)
    Local Static $globals
    If Not $globals Then
        Global $g_gtn_key,$g_gtn_exitloop
    If $g_gtn_key Then HotKeySet('{'&$g_gtn_key&'}')
    $g_gtn_key = $Key

Func GoToNextLine($ExInfo_BeforeNext = '',$ExInfo_AfterNext = '')
    If Not IsDeclared('g_gtn_exitloop') Then Return SetError(1) ; You need to call GoToNextLine_HotKeySet() first

    Local Static $iLineCallNumber = 1
    If $ExInfo_BeforeNext Then ConsoleWrite('Description for next Call: '&$ExInfo_BeforeNext & @CRLF)
    Until $g_gtn_exitloop
    ConsoleWrite('GoToNextLine - Call '&$iLineCallNumber& @CRLF)
    If $ExInfo_AfterNext Then ConsoleWrite('Description for this Call: '  & $ExInfo_AfterNext& @CRLF)
    $iLineCallNumber += 1
    $g_gtn_exitloop = 0

Func GoToNextLine_ExitLoop()
    $g_gtn_exitloop = 1


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


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.