Daywap Posted December 7, 2009 Share Posted December 7, 2009 Hi, I am creating script that would get random line from txt and make it to be inputed somewhere. How to do it? I am currently have this $file = FileOpen("test.txt", 0) $i = Random(1, 99999999, 1) Random(line) FileClose($file) I know this sounds stupid, but please how to get random line? Thank you very much Link to comment Share on other sites More sharing options...
jvanegmond Posted December 7, 2009 Share Posted December 7, 2009 (edited) We are still trying to answer your question here: http://www.autoitscript.com/forum/index.php?showtopic=106288Perhaps you could be more active in the discussion there, because we are waiting.Edit: PPPLLLLLLLLLLEEEEEEEEEEAAAAAAAASSSSSSEEEEEEEE Edited December 7, 2009 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
99ojo Posted December 7, 2009 Share Posted December 7, 2009 Hi, I am creating script that would get random line from txt and make it to be inputed somewhere. How to do it? I am currently have this $file = FileOpen("test.txt", 0) $i = Random(1, 99999999, 1) Random(line) FileClose($file) I know this sounds stupid, but please how to get random line? Thank you very much Hi, although i don't believe you have an text file with 99999999 lines and it's hopefully not written by Bruce Forte: $file = FileOpen("test.txt", 0) $i = Random(1, 99999999, 1) MsgBox (0, "Line " & $i, $line = FileReadLine ($file, $i)) FileClose($file) ;-)) Stefan Link to comment Share on other sites More sharing options...
skyboy Posted December 7, 2009 Share Posted December 7, 2009 #Include <File.au3> $sFile = "text.txt" $lines = _FileCountLines($sFile) $sFile = FileOpen($sFile) $line = FileReadLine($sFile, Random(1, $lines, 1)) FileClose($sFile) you should read the helpfile included with autoit : C:\Program Files\AutoIt3\AutoIt.chm Link to comment Share on other sites More sharing options...
Daywap Posted December 7, 2009 Author Share Posted December 7, 2009 #Include <File.au3> $sFile = "text.txt" $lines = _FileCountLines($sFile) $sFile = FileOpen($sFile) $line = FileReadLine($sFile, Random(1, $lines, 1)) FileClose($sFile) you should read the helpfile included with autoit : C:\Program Files\AutoIt3\AutoIt.chm Why is it not working? I created text.txt but it gets me error in 4 line Link to comment Share on other sites More sharing options...
Baraoic Posted December 7, 2009 Share Posted December 7, 2009 (edited) Its because FileOpen needs to be used with a mode.#Include <File.au3> $sFile = "text.txt" $lines = _FileCountLines($sFile) $sFile = FileOpen($sFile, 0) $line = FileReadLine($sFile, Random(1, $lines, 1)) FileClose($sFile) Edited December 7, 2009 by Onichan Link to comment Share on other sites More sharing options...
Daywap Posted December 7, 2009 Author Share Posted December 7, 2009 Its because FileOpen needs to be used with a mode. #Include <File.au3> $sFile = "text.txt" $lines = _FileCountLines($sFile) $sFile = FileOpen($sFile, 0) $line = FileReadLine($sFile, Random(1, $lines, 1)) FileClose($sFile) Can you post example please? Link to comment Share on other sites More sharing options...
jvanegmond Posted December 7, 2009 Share Posted December 7, 2009 Can you post example please? github.com/jvanegmond Link to comment Share on other sites More sharing options...
Daywap Posted December 7, 2009 Author Share Posted December 7, 2009 My bad ;P. Okay, that's what I added. But it still not work I get error in 6 Line. #Include <File.au3> #Include <FF.au3> $sFile = "text.txt" $lines = _FileCountLines($sFile) $sFile = FileOpen($sFile) $line = FileReadLine($sFile, Random(1, $lines, 1)) FileClose($sFile) _FFPrefSet("general.useragent.override", String($line)) Can you help me? Link to comment Share on other sites More sharing options...
dantay9 Posted December 7, 2009 Share Posted December 7, 2009 You still don't have a mode. $sFile = FileOpen($sFile, 0) Look in the help file for required and optional parameters. Link to comment Share on other sites More sharing options...
RagsRevenge Posted December 7, 2009 Share Posted December 7, 2009 (edited) My bad ;P. Okay, that's what I added. But it still not work I get error in 6 Line. #Include <File.au3> #Include <FF.au3> $sFile = "text.txt" $lines = _FileCountLines($sFile) $sFile = FileOpen($sFile) $line = FileReadLine($sFile, Random(1, $lines, 1)) FileClose($sFile) _FFPrefSet("general.useragent.override", String($line)) Can you help me? put your mouse on fileOpen, and press F1. Edited December 7, 2009 by RagsRevenge Link to comment Share on other sites More sharing options...
jvanegmond Posted December 8, 2009 Share Posted December 8, 2009 My bad ;P. Okay, that's what I added. But it still not work I get error in 6 Line. #Include <File.au3> #Include <FF.au3> $sFile = "text.txt" $lines = _FileCountLines($sFile) $sFile = FileOpen($sFile) $line = FileReadLine($sFile, Random(1, $lines, 1)) FileClose($sFile) _FFPrefSet("general.useragent.override", String($line)) Can you help me? github.com/jvanegmond Link to comment Share on other sites More sharing options...
trancexx Posted December 8, 2009 Share Posted December 8, 2009 I don't get it What do you mean Manadar? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Baraoic Posted December 8, 2009 Share Posted December 8, 2009 Ha sorry I know I clicked edit and fixed the mode thing. Anyways if you still haven't realized it by now the line $lines = _FileCountLines($sFile) should be $lines = _FileCountLines($sFile, 0) Link to comment Share on other sites More sharing options...
jvanegmond Posted December 8, 2009 Share Posted December 8, 2009 (edited) Ha sorry I know I clicked edit and fixed the mode thing. Anyways if you still haven't realized it by now the line $lines = _FileCountLines($sFile) should be $lines = _FileCountLines($sFile, 0) Edited December 8, 2009 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
James Posted December 8, 2009 Share Posted December 8, 2009 (edited) Why bother Manadar? He's been told to read the help file, but quite clearly stuggles at that task alone. SRS?http://fc05.deviantart.net/fs31/f/2008/213/4/9/O_RLY__Y_SO_SRS__by_Areyu.jpg Edited December 8, 2009 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Daywap Posted December 8, 2009 Author Share Posted December 8, 2009 My bad. THANK YOU VERY MUCH Link to comment Share on other sites More sharing options...
jvanegmond Posted December 8, 2009 Share Posted December 8, 2009 No problem at all. I enjoyed making fun of you quite a lot. github.com/jvanegmond Link to comment Share on other sites More sharing options...
trancexx Posted December 8, 2009 Share Posted December 8, 2009 I still don't get it. it's a bug, right? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Baraoic Posted December 8, 2009 Share Posted December 8, 2009 Lol yall are so bad though granted it was pretty blatant. Link to comment Share on other sites More sharing options...
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