Jump to content

Creating an Array from a list


 Share

Recommended Posts

I am querying a control box in a program which contains a list of text similar to below, I am able to get this information read into a variable and displaying it in a large MSGBOX.

Object A

Object B

Object C

...

Object X

What I want to be able to do if write a peice of script which enters each line of the control box into an array so that I can manipulate each entry.

Any help woul dbe great.

Thank you

Philip

Link to comment
Share on other sites

I am querying a control box in a program which contains a list of text similar to below, I am able to get this information read into a variable and displaying it in a large MSGBOX.

Object A

Object B

Object C

...

Object X

What I want to be able to do if write a peice of script which enters each line of the control box into an array so that I can manipulate each entry.

Any help woul dbe great.

Thank you

Philip

StringSplit should work with the way your doing it now.

Not enough info to help any more.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Yes, stringsplit will work...

So will _FileReadToArray()

#include <file.au3>
Dim   $aRecords
If Not   _FileReadToArray("error.log",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array       error:" & @error)
   Exit
EndIf
For $x =   1 to $aRecords[0]
    Msgbox(0,'Record:' & $x, $aRecords[$x])
Next

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

I am querying a control box in a program which contains a list of text similar to below, I am able to get this information read into a variable and displaying it in a large MSGBOX.

Object A

Object B

Object C

...

Object X

What I want to be able to do if write a peice of script which enters each line of the control box into an array so that I can manipulate each entry.

Any help woul dbe great.

Thank you

Philip

If you run the following, what do you get?

#include <array.au3>

$WinTitle = "Title of Window" ; <=== Edit for title
$CtrlID = 1234 ; <=== Edit for control ID
$TextIn = ControlGetText($WinTitle, "", $CID)

MsgBox(64, "Read Data", "Text = " & $TextIn)

$SplitArray = StringSplit($TextIn, @CRLF)
_ArrayDisplay($SplitArray, "$SplitArray")

The interesting thing will be how lines are delimited. The above code uses @CRLF, but it might be just @CR or @LF, or some other character.

:)

P.S. It matters what kind of control, to. For example a listview can be read one item at a time by ControlListView() commands.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...