Jump to content

Getting Information from an Array


Recommended Posts

I need to retrieve one substring from an array without knowing it's ID, only that it contains specific text. I can't use a variable in the brackets for a substring. Anyone know how I might be able to do this? I have a file with multiple lines, but I want to pick out one line based on a search of the text.

Coming soon....

Link to comment
Share on other sites

for $i = 0 to ubound($array, 1) - 1
if stringinstr($array[$i], "search string") then
;....do w/e
endif
Next

~cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to comment
Share on other sites

maybe

#include <file.au3>

$File_name = " your file name"
$text_to_look_for = " what you want to find"

Dim $aRecords
If Not _FileReadToArray($File_name,$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
For $x = 1 to $aRecords[0]
    If StringInStr($aRecords[$x], $text_to_look_for) Then
        Msgbox(0,'Found:' & $x, $aRecords[$x])
    ; do something else???
    EndIf
Next

8)

NEWHeader1.png

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