PcExpert Posted May 1, 2006 Share Posted May 1, 2006 Hello, Can I make a program that sends text thats in a ini file, but it just picks a line of text from the ini. So for example: Ini-file: [text]1=hello 2=how are you? 3=How old are you? 4=what is the best script you've created with autoit? first it picks a numer between 1 and 4, then it send the text of the specified number. Is that possible? Thanks Link to comment Share on other sites More sharing options...
RazerM Posted May 1, 2006 Share Posted May 1, 2006 Easy:Send(IniRead(@ScriptDir & "\text.ini", "text", Random(1,4,1), "")) My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
PcExpert Posted May 1, 2006 Author Share Posted May 1, 2006 Thanks Link to comment Share on other sites More sharing options...
PcExpert Posted May 1, 2006 Author Share Posted May 1, 2006 But if I start with sending some text, it sometimes types the same thing twice. So can I get rid of that? Link to comment Share on other sites More sharing options...
RazerM Posted May 1, 2006 Share Posted May 1, 2006 (edited) this should work $last = 0 $rand = Random(1,4,1) While $rand = $last $rand = Random(1,4,1) WEnd $last = $rand Send(IniRead(@ScriptDir & "\text.ini", "text", $rand, "")) surely you could have worked all this out yourself. Every function ive used is in the help file Edited May 1, 2006 by RazerM My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
PcExpert Posted May 1, 2006 Author Share Posted May 1, 2006 (edited) OK, If I want to send another text, must I do it like this$last = 0$rand = Random(1,4,1)While $rand = $last $rand = Random(1,4,1)WEnd$last = $randSend(IniRead(@ScriptDir & "\text.ini", "text", Random(1,4,1), ""))$last = 0$rand = Random(1,4,1)While $rand = $last $rand = Random(1,4,1)WEnd$last = $randSend(IniRead(@ScriptDir & "\text.ini", "text", Random(1,4,1), ""))Or can I do it like this:$last = 0$rand = Random(1,4,1)While $rand = $last $rand = Random(1,4,1)WEnd$last = $randSend(IniRead(@ScriptDir & "\text.ini", "text", Random(1,4,1), ""))Send(IniRead(@ScriptDir & "\text.ini", "text", Random(1,4,1), "")) Edited May 1, 2006 by PcExpert Link to comment Share on other sites More sharing options...
RazerM Posted May 1, 2006 Share Posted May 1, 2006 (edited) i have edited that post (i made a mistake, it should use $rand in IniRead) the first way will work best. I suggest you make a function to help Edited May 1, 2006 by RazerM My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
Valuater Posted May 1, 2006 Share Posted May 1, 2006 (edited) maybe you could copy the ini file to a "temp" ini file and when you read a line, test it for "used", if used then random read another line . if it is not used then use that line of text and write the line as "used" 8) Edited May 1, 2006 by Valuater Link to comment Share on other sites More sharing options...
PcExpert Posted May 1, 2006 Author Share Posted May 1, 2006 (edited) But how can I do this? With file readline and file writeline? If no, what to use?CODE: WinWaitActive("Habbo Hotel - ")Sleep(5000)Send("Hey, welkom bij de Quiz-O-Matic {ENTER}")Sleep(2000)Send("Het spel gaat over een paar seconden beginnen {ENTER}")Sleep(2500)Send("Zit iedereen? Dan gaan we beginnen {ENTER}")Sleep(1000)MouseClick("left", 464, 334, 2)MouseClick("left", 515, 294, 1)Sleep(5000)MouseClick("left", 454, 317, 2)$last = 0$rand = Random(1,20,1)While $rand = $last $rand = Random(1,20,1)WEnd$last = $randSend(IniRead(@ScriptDir & "\text.ini", "text", $rand, ""))Sleep(5000)$last = 0$rand = Random(1,20,1)While $rand = $last $rand = Random(1,20,1)WEnd$last = $randSend(IniRead(@ScriptDir & "\text.ini", "text", $rand, "")) Edited May 1, 2006 by PcExpert Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 1, 2006 Moderators Share Posted May 1, 2006 While you guys are at it, I have 4 or 20 un-finished scripts, will you write them for me? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Valuater Posted May 1, 2006 Share Posted May 1, 2006 took a stab at it... not tested WinWaitActive("Habbo Hotel - ") Sleep(5000) Send("Hey, welkom bij de Quiz-O-Matic {ENTER}") Sleep(2000) Send("Het spel gaat over een paar seconden beginnen {ENTER}") Sleep(2500) Send("Zit iedereen? Dan gaan we beginnen {ENTER}") Sleep(1000) MouseClick("left", 464, 334, 2) MouseClick("left", 515, 294, 1) Sleep(5000) MouseClick("left", 454, 317, 2) Get_Line() Func Get_Line() If Not FileExists(@TempDir & "\temp.ini") Then FileCopy(@ScriptDir & "\text.ini", @TempDir & "\temp.ini", 1) $last = "used" $count = 0 While $last = "used" $count = $count + 1 If $count = 20 Then ExitLoop $rand = Random(1, 20, 1) $last = IniRead(@TempDir & "\temp.ini", "text", $rand, "") Sleep(10) WEnd IniWrite(@TempDir & "\temp.ini", "text", $rand, "used") Send($last) EndFunc ;==>Get_Line later you can write my scripts...lol 8) Link to comment Share on other sites More sharing options...
PcExpert Posted May 2, 2006 Author Share Posted May 2, 2006 Thanks valuatar 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