Jump to content
Sign in to follow this  
haXor4life

Send words from txt file in RANDOM order

Recommended Posts

haXor4life

My dream is to send words from txt file in random order. I can't. Please write code for me for I am incapable of it.

For now I can send JUST ONE word (or piece of text, whatever is put between 'nextpost') one after another.

#include <String.au3>

$Text = FileRead("graph.txt")
$Text = _StringBetween($Text, "NEXTPOST", "NEXTPOST")
For $i = 0 To UBound($Text) -1

MouseClick("left", 15, 0, 1)
Sleep(500) 
Send ("{HOME}")
Sleep(50) 
MouseClick("left", 840, 520, 1)
Sleep(50) 

ClipPut($Text[$i])
Send("+{INSERT}")

MouseClick("left", 840, 500, 1)  
Sleep(100)
MouseClick("left", 210, 0, 1)
Sleep(2 * 58 * 999)
Next

graph.txt looks like this

NEXTPOST1word

NEXTPOSTNEXTPOST2word

NEXTPOSTNEXTPOST3word

NEXTPOSTNEXTPOST4word

NEXTPOSTNEXTPOST5word

NEXTPOSTNEXTPOST6word

NEXTPOSTNEXTPOST7word

NEXTPOSTNEXTPOST8word

NEXTPOSTNEXTPOST9word

NEXTPOSTNEXTPOST10word

NEXTPOSTNEXTPOST11word

NEXTPOSTNEXTPOST12word

This script works! Please help me to make script just like this but which could send random number of words from this text file in single send session and words should be taken in random order!!!

Edited by haXor4life

Share this post


Link to post
Share on other sites
electrico

Hi. I don't actually think that I can help alot, but here is for one random phrase, (if 1 phrase = 1 text line in a text file)

FileReadLine("textfile.txt", Random(1,14,1))

14 here - is a number of rows in a text file.

Edited by electrico

Share this post


Link to post
Share on other sites
haXor4life

Hi. I don't actually think that I can help alot, but here is for one random phrase, (if 1 phrase = 1 text line in a text file)

FileReadLine("textfile.txt", Random(1,14,1))

14 here - is a number of rows in a text file.

Thanks! How do I send this random line?

Random number of random lines sent at once is my exact goal! (Code may have as many sends as needed cause what's really sending it is mouseclick.)

My code is just like this FileReadLine which uses enter signs to define single piece of text. My code uses "nextpost" for it.

Edited by haXor4life

Share this post


Link to post
Share on other sites
hawky358

This sends a random line when you press Ctrl+1.

You can use it as an example for what you want

#Include <File.au3>
HotKeySet("^1","typeword")
$filename = "lines.txt"

$file = FileOpen($filename,0)
$line = _FileCountLines($filename)

while 1
        sleep(12)
WEnd


func typeword()
    $rand = Random(1,$line,1)
    $word = FileReadLine($file,$rand)
    Send($word)
EndFunc
Edited by hawky358

Share this post


Link to post
Share on other sites
haXor4life

This sends a random line when you press Ctrl+1.

You can use it as an example for what you want

I don't know how.

Share this post


Link to post
Share on other sites
hawky358

At the moment when you press ctrl+1 it reads a random line from the text file and sends it to the active window.

What else do you want it to do? I'll try to help

Share this post


Link to post
Share on other sites
haXor4life

Thanks, Hawky. I tried to mix your and my scripts but it didn't work well.

#Include <File.au3>
HotKeySet("^1","typeword")
$filename = "graph.txt"
$file = FileOpen($filename,0)
$line = _FileCountLines($filename)
while 1
sleep(12)
WEnd
func typeword()
    $rand = Random(1,$line,1)
    $word = FileReadLine($file,$rand)
    Send($word)
EndFunc

MouseClick("left", 15, 0, 1)
Sleep(500) 
Send ("{HOME}")
Sleep(50) 
MouseClick("left", 840, 520, 1)
Sleep(50) 

Send("^1")

MouseClick("left", 840, 500, 1)  
Sleep(100)
MouseClick("left", 210, 0, 1)
Sleep(5 * 58 * 999)

It doesn't do what I want it to do. It doesn't even move my mouse. I want this script to move my mouse, then Send, then move my mouse again, wait for 6 min and repeat. It doesn't do it.

Share this post


Link to post
Share on other sites
hawky358

It doesn't do what I want it to do. It doesn't even move my mouse. I want this script to move my mouse, then Send, then move my mouse again, wait for 6 min and repeat. It doesn't do it.

Ok I misunderstood your intent.

- It moves your mouse to a text box and clicks it

- It enters text

- Then presses enter???

- Then moves the mouse

- Waits 6 min and repeat?

Is this what you want?

Share this post


Link to post
Share on other sites
hawky358

Working on the assumption that what I said above is what you want:

This should do what you want (You can change the $repeat var to something low like 0.3 for testing if you want)

#Include <File.au3>
$filename = "graph.txt"
global $timer
$repeat = 6 ;Mins between repeat

$file = FileOpen($filename,0)
$line = _FileCountLines($filename)



mouseaction()

while 1
    sleep(500)
    $timed = TimerDiff($timer)
    if $timed > $repeat*60*1000 Then
        mouseaction()
    EndIf
WEnd

        


func sendwords()
    $rand = Random(1,$line,1)   
    $word = FileReadLine($file,$rand)
    Send($word & "{ENTER}")
EndFunc


func mouseaction()
    MouseClick("left", 15, 0, 1)
    Sleep(500) 
    Send ("{HOME}")
    Sleep(50) 
    MouseClick("left", 840, 520, 1)
    Sleep(50) 

    sendwords()
    
    MouseClick("left", 840, 500, 1)  
    Sleep(100)
    MouseClick("left", 210, 0, 1)
    $timer = TimerInit()
EndFunc

Share this post


Link to post
Share on other sites
haXor4life

Ok I misunderstood your intent.

- It moves your mouse to a text box and clicks it

- It enters text

- Then presses enter???

- Then moves the mouse

- Waits 6 min and repeat?

Is this what you want?

Yes! Except presses enter part. It presses button with a mouse which sends entered text. Edited by haXor4life

Share this post


Link to post
Share on other sites
hawky358

Ok, then just remove the {ENTER} from the code

Edited by hawky358

Share this post


Link to post
Share on other sites
haXor4life

Oh my god it works, thank you.

Share this post


Link to post
Share on other sites
haXor4life

Sending random words like a mofo!

Can I somehow randomise number of sended random lines like from 1 to 9? Or just simply send 5 random lines at once plz?

Share this post


Link to post
Share on other sites
hawky358

Can I somehow randomise number of sended random lines like from 1 to 9? Or just simply send 5 random lines at once plz?

Do you mean like this

word1 word2 word3 word4 <SEND>

<wait 6min>

or this

word1 <SEND>
word2 <SEND>
word3 <SEND>
word4 <SEND>

<wait 6min>

Share this post


Link to post
Share on other sites
hawky358

Either way you'll be inserting this somewhere

for $i = 1 to random(1,9,1)
  ;the code to be repeatedl
next
Edited by hawky358

Share this post


Link to post
Share on other sites
DW1

Looks like a horrible attempt at bruteforcing...

Why people on this forum insist on helping people with names like "haXor4life" create a script that looks a lot like a bruteforce utility, I will never understand. Just my $.02

Also, why people join this forum with names like "haXor4life" when they clearly know very little also blows my mind... do you not realize that the regulars here that actually know WTF they are doing are laughing at you when they see this crap?

The only reason I write this is because we really shouldn't be so disrespectful to the mods, admins, and VIP's by helping people make AutoIt look bad. Ultimately it is your decision, but this one just sure seems like it shouldn't have gotten a response to me. Maybe I am just reading too much into it.

Edited by danwilli

Share this post


Link to post
Share on other sites
enaiman

@danwilli

You "spoke my mind". I remember some time ago I had exactly the same thoughts about the same "person" but I thought that maybe I was paranoid. I wasn't.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
haXor4life

Looks like a horrible attempt at bruteforcing...

Why people on this forum insist on helping people with names like "haXor4life" create a script that looks a lot like a bruteforce utility, I will never understand. Just my $.02

Also, why people join this forum with names like "haXor4life" when they clearly know very little also blows my mind... do you not realize that the regulars here that actually know WTF they are doing are laughing at you when they see this crap?

The only reason I write this is because we really shouldn't be so disrespectful to the mods, admins, and VIP's by helping people make AutoIt look bad. Ultimately it is your decision, but this one just sure seems like it shouldn't have gotten a response to me. Maybe I am just reading too much into it.

Maybe your just an attention whore for posting it here instead of in a private message system directing it "to the mods, admins, and VIP's". As for lame attempt to insult me on my mofo nickname it just speaks of your incapability to think. I apologise for not staying ot topic of this thread.

Share this post


Link to post
Share on other sites
haXor4life

@danwilli

You "spoke my mind". I remember some time ago I had exactly the same thoughts about the same "person" but I thought that maybe I was paranoid. I wasn't.

I don't even remember who you are. "Person"? You're trying to hard to not sound like a retard. Edited by haXor4life

Share this post


Link to post
Share on other sites
haXor4life

Either way you'll be inserting this somewhere

for $i = 1 to random(1,9,1)
  ;the code to be repeatedl
next

I randomly entered it in a code but it didn't work.(((( Help pliz!!!!

#Include <File.au3>
$filename = "numbers.txt"
global $timer
$repeat = 1 ;Mins between repeat

$file = FileOpen($filename,0)
$line = _FileCountLines($filename)

for $i = 1 to random(1,9,1)
  ;the code to be repeatedl
next

mouseaction()

while 1
    sleep(500)
    $timed = TimerDiff($timer)
    if $timed > $repeat*60*1000 Then
        mouseaction()
    EndIf
WEnd

        


func sendwords()
    $rand = Random(1,$line,1)   
    $word = FileReadLine($file,$rand)
    Send($word & "{ENTER}")
EndFunc


func mouseaction()
    MouseClick("left", 15, 0, 1)
    Sleep(500) 
    Send ("{HOME}")
    Sleep(50) 
    MouseClick("left", 840, 520, 1)
    Sleep(50) 

    sendwords()
    
    MouseClick("left", 840, 500, 1)  
    Sleep(100)
    MouseClick("left", 210, 0, 1)
    $timer = TimerInit()
EndFunc
Edited by haXor4life

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  

×