Jump to content

Exit a For Next Loop


Go to solution Solved by ioa747,

Recommended Posts

Posted (edited)

Good day,

How does one exit from the OnCopy() function?

Spoiler
; -----------------------------------------------
#RequireAdmin
; -----------------------------------------------
#include <Constants.au3>
#include <GUIConstantsEx.au3>
; -----------------------------------------------
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)
; -----------------------------------------------
Global $g_idButton_Exit
; -----------------------------------------------
_Main()
; -----------------------------------------------
Func _Main()
    GUICreate("", 130, 40)
    ; ---------------------
    Local $idButton_Yes = GUICtrlCreateButton("Copy", 10, 10, 50, 20)
    GUICtrlSetOnEvent($idButton_Yes, "OnCopy")
    ; ---------------------
    $g_idButton_Exit = GUICtrlCreateButton("Exit", 70, 10, 50, 20)
    GUICtrlSetOnEvent($g_idButton_Exit, "OnExit")
    GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit")
    ; -----------------------------------------------
    GUISetState()
    ; -----------------------------------------------
    While 1
        Sleep(1000)
    WEnd
EndFunc   ;==>_Main
; -----------------------------------------------
Func OnCopy()
    Local $sFilePath = "E:\Desktop\Working\Tests\ReadIni\P7.ini"
    Local $aArray = IniReadSection($sFilePath, "Scene Data")
    ConsoleWrite(@error & @CRLF)
    If Not @error Then
        For $i = 1 To $aArray[0][0]
            MsgBox($MB_OKCANCEL, "", $aArray[$i][1] & "...will be copied to the Clipboard....continue...")
            ConsoleWrite(@error & @CRLF)
            ClipPut($aArray[$i][1])
        Next
    EndIf
EndFunc   ;==>OnCopy
; -----------------------------------------------
Func OnExit()
    If @GUI_CtrlId = $g_idButton_Exit Then
        Exit
    EndIf
EndFunc   ;==>OnExit
; -----------------------------------------------

 

Any assistance in this matter would be greatly appreciated!

Edited by mr-es335
Posted
1 hour ago, mr-es335 said:

How does one exit from the OnCopy() function?

the issue here is not how you exit, but what you want to do.
Otherwise I would tell you to press OK or Cancel until the keys from the ini file are finished, and then it will exit

I know that I know nothing

Posted

ioa747,

Before I comment, this comment has to do with you personally, but....

1) After some 3-4 hours of trying various "ways-and-means", I then observe what you have done and ask "So simple...yet completely beyond my pervue!"

2) Thus, what I would love to know is how do you "apparently" - come up with the solutions that you do?

Posted
3 hours ago, mr-es335 said:

Thus, what I would love to know is how do you "apparently" - come up with the solutions that you do?

what can I say?  :)
it's like a crossword puzzle, the more you solve, the easier it becomes.
You don't have to solve it all, not even if you write a word wrong, because as you solve, you will find it in front of you, and you will correct it

I know that I know nothing

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
  • Recently Browsing   0 members

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