Sign in to follow this  
Followers 0
PcExpert

Send Text From A Ini File

12 posts in this topic

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

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

Thanks

Share this post


Link to post
Share on other sites

But if I start with sending some text, it sometimes types the same thing twice. So can I get rid of that?

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 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.

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 = $rand

Send(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 = $rand

Send(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 = $rand

Send(IniRead(@ScriptDir & "\text.ini", "text", Random(1,4,1), ""))

Send(IniRead(@ScriptDir & "\text.ini", "text", Random(1,4,1), ""))

Edited by PcExpert

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 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.

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#9 ·  Posted (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 = $rand

Send(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 = $rand

Send(IniRead(@ScriptDir & "\text.ini", "text", $rand, ""))

Edited by PcExpert

Share this post


Link to post
Share on other sites

#10 ·  Posted

While you guys are at it, I have 4 or 20 un-finished scripts, will you write them for me? :think:


[center]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.[/center]

Share this post


Link to post
Share on other sites

#11 ·  Posted

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)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#12 ·  Posted

Thanks valuatar

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