Jump to content

Recommended Posts

Posted

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.

Posted

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)

Posted

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

Posted

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.

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