Olsenius Posted July 26, 2005 Posted July 26, 2005 I'm working on a little utility to edit some .htm files from a game i play. The numbers on the page are images with random name. I have isolated the img names. And made this function to give me the right number. $number = finnNr("adfmd.gif") MsgBox(0, "test", $number) Exit Func finnNr($search) $file = FileOpen("img.txt",1) While 1 $line = FileReadLine($file, 1) If $search == $line Then Return FileReadLine($file, 1) EndIf If @error Then ExitLoop WEnd Return "NA" EndFunc the start of img.txt is: adfmd.gif 5 aepvl.gif 8 aidph.gif 4 amljf.gif 9 asnfd.gif 8 As i see this shuld return "5", but it only give me "NA". I cant see what i'm doing wrong. If you see whats wrong or know a better way to do it please let me know. Thanks. -Ols
therks Posted July 26, 2005 Posted July 26, 2005 Wrong FileOpen parameter. 1 is write mode. You want to read, which is parameter 0. Mode (read or write) to open the file in. 0 = Read mode 1 = Write mode (append to end of file) 2 = Write mode (erase previous contents) 4 = Read raw mode My AutoIt Stuff | My Github
Olsenius Posted July 26, 2005 Author Posted July 26, 2005 Thank you! That did the trick. Added a counter and changed to readmode and it works like a charm.
/dev/null Posted July 26, 2005 Posted July 26, 2005 (edited) two questions for you: 1.) What does FileOpen() when you call it with option 1? 2.) What does FileReadLine() when you call it with a second parameter? The answer to those questions will make your script work. EDIT: Damn... too late ... Cheers Kurt Edited July 26, 2005 by /dev/null __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now