Jump to content

How do i use fileread with only a partial filename?


Recommended Posts

Im a total noob to autoit, and have only written a few scripts with actool in the past. This is to look in a chat log from a game and see if a certain string is in it. The game auto time stamps the file, so it would be c:\chatlog_time_date.txt

this is what i got so far, but it doesnt work

CODE
$file = FileFindFirstFile("c:\chatlog*.txt")

$Contents = FileRead($file)

$location = StringInStr($contents,"sometext")

If $location Then MsgBox(0,"Found","The search string is in the log")

Edited by wpsatisfide
Link to comment
Share on other sites

Your not declaring a true... like

$file = FileFindFirstFile("c:\chatlog*.txt")
$Contents = FileRead($file)
$location = StringInStr($contents,"sometext")

If $location = 1  Then 
MsgBox(0,"Found","The search string is in the log")
endif

but then again i dont understand wtf you are trying to do here...

you want to read the text document or tell you if there is text in it?

tolle indicium

Link to comment
Share on other sites

up cause im 4 pages back.

What i want to do is make a buffbot for a game. This bot would cast buffs on another player if given the password in a tell.

The part I need help with is this. I can type /log in game and it creates a chat log file in the format Chat_log_year_date_time.txt, I cant specify the file name like /log chatlog.txt.

So what I need to do is open this logfile every minute or 2 and scan for the password. This is the only part I need help with. As i mentioned I have used actool and in asherons call i could specify the filename when saving it and easily search the file.

Actool does not support wildcard filename searches so thats why im here. Although autoit is more complicated, I think it will be able to do what i want.

After I get to the point where I can check for the password, the rest of the file should be a breeze.

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