Jump to content

Help - Search Array - _ArraySearch


Recommended Posts

Hello everyone,

I haven't been programing with autoit for very long. I have a problem and i can understand how I can work around it.

I want to search a txt file, and search for a specific word and return all the results but my problem keeps on giving me the first one it found?

Thanks,

Keith

Heres my code.

#Include<Array.au3>
#include <file.au3>
Dim $pricehistory,$found
$filename = "pricehistory.txt"
$apptile = "Search!"

$Input = InputBox("Price History Search", "Find?")
If @error Then Exit

If Not _FileReadToArray($filename,$pricehistory) Then
   MsgBox(4096,$apptitle, "Error reading watchlist:" & @error)
   Exit
EndIf
For $x = 1 to $pricehistory[0]
$found = _ArraySearch ($pricehistory, $Input, 0, 0, 0, True)
MsgBox(0,"Found",$found)
Next
Edited by Kogmedia
[font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search
Link to comment
Share on other sites

#Include<Array.au3>
#include <file.au3>

Dim $pricehistory,$found
$filename = "pricehistory.txt"
$apptitle = "Search!"

$Input = InputBox("Price History Search", "Find?")
If @error Then Exit

If Not _FileReadToArray($filename,$pricehistory) Then
   MsgBox(4096,$apptitle, "Error reading watchlist:" & @error)
   Exit
EndIf

$found = _ArraySearch ($pricehistory, $Input, 0, 0, 0, True)
MsgBox(0,"Found",$found)

Link to comment
Share on other sites

Hello everyone,

I haven't been programing with autoit for very long. I have a problem and i can understand how I can work around it.

I want to search a txt file, and search for a specific word and return all the results but my problem keeps on giving me the first one it found?

Thanks,

Keith

Heres my code.

#Include<Array.au3>
#include <file.au3>
Dim $pricehistory,$found
$filename = "pricehistory.txt"
$apptile = "Search!"

$Input = InputBox("Price History Search", "Find?")
If @error Then Exit

If Not _FileReadToArray($filename,$pricehistory) Then
   MsgBox(4096,$apptitle, "Error reading watchlist:" & @error)
   Exit
EndIf
For $x = 1 to $pricehistory[0]
$found = _ArraySearch ($pricehistory, $Input, 0, 0, 0, True)
MsgBox(0,"Found",$found)
Next

Edit: changed For next to while wend

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...