Jump to content
youtuber

How to sort the array list one by one?

Recommended Posts

youtuber

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

 

Share this post


Link to post
Share on other sites
Simpel

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 = Win7Pro SP1   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.

Share this post


Link to post
Share on other sites
youtuber

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

 

Share this post


Link to post
Share on other sites
Simpel

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 

  • Like 1

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   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.

Share this post


Link to post
Share on other sites
youtuber

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

 

Share this post


Link to post
Share on other sites
Simpel

Yes, so you can do it in cycles.

  • Like 1

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   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.

Share this post


Link to post
Share on other sites
youtuber

Thank you, is there another example of this? :)

 

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

×