Sign in to follow this  
Followers 0
jjump

Need to be able to take a random word from a file and enter into a send command

6 posts in this topic

Need to be able to take a random word from a file and enter into a send command.. So, it would be Send("THEN THE RANDOM WORD FROM FILE").. Is this possible?

Thanks

Ian

Share this post


Link to post
Share on other sites



is it a txt file? How big is it? How many lines of code does it have? Where do you want to send the word? always Give as much info as possible.!


My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

If you have 1 word per line you could do

$file = FileOpen("YourFile.txt")
Filereadline($file,Random(1, <however many lines your file is>))
FileClose($file
Edited by yyyy273

Share this post


Link to post
Share on other sites

Hi,

Thank you for your replies.. The file would be a text file with one word per line and have about 200 words.. The word would just be sent using the Send command.. With the above example, how would you code that into a send command?

Many Thanks

Ian

Share this post


Link to post
Share on other sites

something like this

;~ Count How mny lines are in the file - $i
For $i = 1 to 999999999999999999
    $line = FileReadLine('doujin[001].txt',$i) ; readline
    If @error = -1 Then ExitLoop ; exit,loop if end of file
    ToolTip('line: ' & $i & ' ' &$line,0,0)
Next


While 1
    $random = Random(1, $i, 1) ; generate an integer between 1 and $i - is the Nr of lines we found
    $line = FileReadLine('doujin[001].txt',$random)
    Send($line & @CRLF)
    Sleep(1000)
WEnd

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites

Thank you ! Works perfectly!

Ian

Share this post


Link to post
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
Sign in to follow this  
Followers 0