Jump to content

Array Help


Recommended Posts

I am new to AutoIT and attempting to import text from a GUICTRLCREATEEDIT field into an array.

I want each line of text to be in imported into a separate Array field

Text line 1 ====> array[0]

Text line 2 ====> array[1]

Text line 3 ====> array[2]

etc.............

Any help will be appreciated thanks.

Link to comment
Share on other sites

I am new to AutoIT and attempting to import text from a GUICTRLCREATEEDIT field into an array.

I want each line of text to be in imported into a separate Array field

Text line 1 ====> array[0]

Text line 2 ====> array[1]

Text line 3 ====> array[2]

etc.............

Any help will be appreciated thanks.

Use

$sInput = GuiCtrlRead($hHandle ...)

And Use

$aSplit = StringSplit($sInput, @CRLF, 3)

Link to comment
Share on other sites

Maybe...

#include <array.au3>

GUICreate("My GUI")
$Edit1 = GUICtrlCreateEdit("", 10, 10, 300, 200)
GUICtrlSetData(-1, "Type in your lines")
$Button1 = GUICtrlCreateButton("Click Here", 100, 300, 150, 30)
GUISetState()

While 1

    $msg = GUIGetMsg()

    If $msg = -3 Then Exit

    If $msg = $Button1 Then
        $array = StringSplit(StringStripCR(GUICtrlRead($Edit1)), @LF)
        _ArrayDisplay($array)
    EndIf

WEnd

8)

NEWHeader1.png

Link to comment
Share on other sites

Thank you athiwatc and Valuater. Your suggestions have helped me resolve my little problem.

I ended up using GUICtrlRead to input to a variable and then ran the variable through StringSplit using commas as delimiters, but I like that function StringStripCR to remove carriage values. I'll have to study the Help files more. This forum has been very helpful. Thank you.

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