Sign in to follow this  
Followers 0
McGod

Doesn't send right

18 posts in this topic

#1 ·  Posted (edited)

This script doesnt want to display the $line command in send funticion

My Script :P

Any suggestions\fixes or why it isnt working?

Edited by Chip

Share this post


Link to post
Share on other sites



Change Send ( "$line" ) to Send ( $line )



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Change Send ( "$line" ) to Send ( $line )

It works now but it only uses first line?

any way of it going threw the list?

Share this post


Link to post
Share on other sites

It works now but it only uses first line?

any way of it going threw the list?

The way you are using FileReadLine it will only read the first line. See the example in the help file for the proper way to read every line.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

MouseClick("left", 303, 650, 1)

;Create Character

While 1

MouseClick("left", 579, 418, 1)

;Selects Char

$file = FileOpen("test.txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in lines of text until the EOF is reached

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

Send ( "$line" )

;Characters Name

MouseClick("left", 881, 711, 1)

;Hits OK

MouseClick("left", 598, 478, 1)

;Hits Retry

for every line?

Share this post


Link to post
Share on other sites

i tried adding

MouseClick("left", 579, 418, 1)

;Selects Char

$file = FileOpen("test.txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in lines of text until the EOF is reached

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

Send ( $line )

;Characters Name

MouseClick("left", 881, 711, 1)

;Hits OK

MouseClick("left", 598, 478, 1)

;Hits Retry

again but

$line = FileReadLine(2)

It gave error

any easier way of reading text from file and sending it?

Share this post


Link to post
Share on other sites

Replace this

; Read in lines of text until the EOF is reached

    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop

Send ( "$line" )

with this

; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop

Send ( "$line" )
Wend


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I gave the udf to look at:

#include <file.au3>
Local $FilePath = FileOpenDialog('Find File To Send Text', @ScriptDir, 'All Files (*.*)')
Local $nArray = ''
_FileReadToArray($FilePath, $nArray)

SendStrings($nArray)

Func SendStrings(ByRef $nArray)
    For $i = 1 To UBound($nArray) - 1
        Send($nArray[$i])
    Next
EndFunc

Edit: BigDod beat me, but now you have 2 different ways.

Edited by SmOke_N

[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

#include <file.au3>
Local $FilePath = FileOpenDialog('Find File To Send Text', @ScriptDir, 'All Files (*.*)')
Local $nArray = ''
_FileReadToArray($FilePath, $nArray)

SendStrings($nArray)

Func SendStrings(ByRef $nArray)
    For $i = 1 To UBound($nArray) - 1
        Send($nArray[$i])
    Next
EndFunc

I dont get where you put this or where you put the file.au3

Share this post


Link to post
Share on other sites

I probably (I know I did, over complicate it for you, but I really don't understand what your trying to do, if your trying to repeat that time and time again or whatever

#include <file.au3>
Opt('MouseCoordMode', 0); check Opt('MouseCoordMode') in the help file to see what you need to set 0 to.
Local $FilePath = FileOpenDialog('Find File To Send Text', @ScriptDir, 'All Files (*.*)')
Local $nArray = ''
_FileReadToArray($FilePath, $nArray)
MouseClick("left", 579, 418, 1, 1)
SendStrings($nArray)

Func SendStrings(ByRef $nArray)
    For $i = 1 To UBound($nArray) - 1
        If $i = 1 Then
            Send($nArray[$i])
            MouseClick("left", 881, 711, 1)
            MouseClick("left", 598, 478, 1)
        ElseIf $i = 2 Then
            MouseClick("left", 579, 418, 1, 1)
            Send($nArray[$i])
            MouseClick("left", 881, 711, 1)
            MouseClick("left", 598, 478, 1)
        Else
            ExitLoop
        EndIf       
    Next
EndFunc
If your doing it more than twice just copy the ElseIf and put in another one with 3, 4, 5 etc... A while loop would be better probably for you, but to be honest, I'm to tired to re-write it.


[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

Have you tried my suggestion?



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

The idea i want it to try is to like

It tries a name,if the name exists it hits ok and then repeats with a new name.

When i tried ur suggestion it put all 3 lines into the box and tried

and Smoke_N i dont know what i need in file.au3

So pretty much it repeats a process with a new name that comes from a text file

Share this post


Link to post
Share on other sites

Well i want to be able to do like more then 50 names is there any way other then the copy n paste method to do it?

Share this post


Link to post
Share on other sites

The too ways already given should go as many as are in the text file. If you haven't tried it yet, it should work. If it doesn't, post updated code and we'll try to help.

Btw, why are you trying different character names for D2?

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

The too ways already given should go as many as are in the text file. If you haven't tried it yet, it should work. If it doesn't, post updated code and we'll try to help.

Btw, why are you trying different character names for D2?

Namebot

New Code is pretty big

trys 30 names

Edited by Chip

Share this post


Link to post
Share on other sites

I think you're just a bit confused. All you should need is:

Func SendStrings(ByRef $nArray)
    For $i = 1 To UBound($nArray) - 1
        If $i = 1 Then
            Send($nArray[$i])
            MouseClick("left", 1005, 845, 1);OK
            MouseClick("left", 715, 609, 1);Retry
        Else
            MouseClick("left", 720, 551, 1, 1);Selects Char
            Send($nArray[$i])
            MouseClick("left", 1005, 845, 1);OK
            MouseClick("left", 715, 609, 1);Retry
    EndIf       
    Next
EndFunc

I left the If Then in there because I noticed that if it $i=1 then it doesn't do the initial click. Seeing as how that selects the character, probably want you really want the function to be:

Func SendStrings(ByRef $nArray)
    For $i = 1 To UBound($nArray) - 1
            MouseClick("left", 720, 551, 1, 1);Selects Char
            Send($nArray[$i])
            MouseClick("left", 1005, 845, 1);OK
            MouseClick("left", 715, 609, 1);Retry
    Next
EndFunc

Share this post


Link to post
Share on other sites

*Does Happy Dance*

Worked Perfectly

Thanks

Share this post


Link to post
Share on other sites

Thanks Oxin8, I got caught up in the superbowl and guest, thanks for helping him out with my post :lmao:.


[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

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