Jump to content

How to sort the array list one by one?


youtuber
 Share

Recommended Posts

How do I write a console with one by one sequence with a button?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $aAraayList[5] = ["test1", "test2", "test3", "test4"]

$Form1 = GUICreate("Form1", 297, 208)
$Button1 = GUICtrlCreateButton("Button1", 112, 144, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            $List = UBound($aAraayList)
            $aAraayList = $aAraayList + 1
            ConsoleWrite($aAraayList[$List] & @CRLF)

    EndSwitch
WEnd

 

Link to comment
Share on other sites

Hi.

Don't increment $aAraayList (btw. array) but $List. Declare $List = 0 before while. Every time pushing the button console write $aAraayList[$List] and increment $List by 1. Don't forget to prove whether $List is above Ubound($aAraayList) every time you push the button before.

Conrad

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

unfortunately :(

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $aAraayList[5] = ["test1", "test2", "test3", "test4"]

$Form1 = GUICreate("Form1", 297, 208)
$Button1 = GUICtrlCreateButton("Button1", 112, 144, 75, 25)
GUISetState(@SW_SHOW)
$List = 0
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            $List = UBound($aAraayList)
            $aAraayList = $aAraayList + 1
            ConsoleWrite($List[$aAraayList] & @CRLF)
    EndSwitch
WEnd

 

Link to comment
Share on other sites

This I meant:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $aAraayList[5] = ["test1", "test2", "test3", "test4"]

$Form1 = GUICreate("Form1", 297, 208)
$Button1 = GUICtrlCreateButton("Button1", 112, 144, 75, 25)
GUISetState(@SW_SHOW)
$List = 0
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            If $List >= UBound($aAraayList) Then ExitLoop
            ConsoleWrite($aAraayList[$List] & @CRLF)
            $List += 1
    EndSwitch
Wend

Conrad 

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

Thanks @Simpel To turn back again?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $aAraayList[5] = ["test1", "test2", "test3", "test4"]

$Form1 = GUICreate("Form1", 297, 208)
$Button1 = GUICtrlCreateButton("Button1", 112, 144, 75, 25)
GUISetState(@SW_SHOW)
$List = 0
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            If $List >= UBound($aAraayList) Then $List = 0
            ConsoleWrite($aAraayList[$List] & @CRLF)
            $List += 1
    EndSwitch
Wend

 

Link to comment
Share on other sites

Yes, so you can do it in cycles.

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

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