Jump to content

Newcomer: /run w parameters/etc


Recommended Posts

Hello, Im having har time to run a program with parameters.

I would like to have 3 different parameters when I run but I don't know how to do.

Also I would like some more help with some basic stuff.

This is what I would like to do:

msgbox

run program (with parameters) after okey pressed

move window to 0, 0 (x,y)

//REPEATING COMMAND 1

Click on x,y

Click x,y send ^a (ctrl)

Read ini file

Send line 1 (from ini)

Send {TAB}

Send line 2 (from ini)

Send {ENTER}

Read ini line 3, (How many boxes pressed)

//

Do *RC 1*

//*Repeating command 2*

Click x,y

Click x,y enter

Sleep 300000

Send {ESC} {DOWN} {ENTER}

Send {ESC}

//

Send {ENTER} (Box 1)

Do *RC 2*

Send {RIGHT} {ENTER} (Box 2)

Do *RC 2*

Send {DOWN} {ENTER} (Box 3)

Do *RC 2*

Send {DOWN} {RIGHT} {ENTER} (Box 4)

Do *RC 2*

Send {DOWN} {DOWN} {ENTER} (Box 5)

Do *RC 2*

Send {DOWN} {DOWN} {RIGHT} {ENTER} (BOX 6)

Do *RC 2*

Send {DOWN} {DOWN} {DOWN} {ENTER} (BOX 7)

Do *RC 2*

Send {DOWN} {DOWN} {DOWN} {RIGHT} {ENTER} (BOX 8)

Do *RC 2*

Send {ESC}

Do *RC 1* BUT read ini line 4,5,6 instead.

and repeat the same pattern for boxes.

This should be as many lines as possible.

Thanks in advance hope you can help me with some.

Specially with reading a ini file and fixing parameters.

Regards,

Humper

[center][/center]

Link to comment
Share on other sites

OK...

Start from the top, make a message box, if you need help, then ask for "that"...then

try to write the "Run()" command with the parameters, if you need help ask for that... then

etc, etc

Remember, we are here to help you learn Autoit, not to take script orders

8)

NEWHeader1.png

Link to comment
Share on other sites

Oh as usual I explained very bad.

The things I didn't really understand is:

Run ("D:\hello.exe" -w -hs)

How do I get run work with parameters?

How do I make it read an .txt / .ini so I can complite it and still change values?

Regards,

Humper

[center][/center]

Link to comment
Share on other sites

Notice the space here before the "C"

$argument = " C:\Test.txt"

Run ('Notepad.exe' & $argument)

8)

Thanks, helped me alot!

Okey this is what I currenly got:

MsgBox(0, "Diablo II", "Hello, this is a Diablo II character checker!")
$argument = " -w -nohide -ns"
Run("D:\Program\Diablo II\Diablo II.exe" & $argument)
WinWaitActive("Diablo II")
WinMove ( "Diablo II", "", 0, 0 )
Sleep (500)
;{Enter} to get to main screen
Send ("{ENTER}")
;Bnet
MouseClick ( "left", 420, 372 )
;Mark the login name
Sleep (2000)
MouseClick ( "left", 474, 358, 2)

But now I need afew more hints how:

- I read a file and then write what it sess.

A file like this:

Account: Lala

Password: Lala

Characters: 6

Then so I can just copy this and it just keep on reading it so it doensn't matter how many I write in.

Is this possible?

- Second this I need help with is that I would

like to repeat things, how do I do that?

Like:

Command1

Mouseclick ("left")

Sleep ("500")

Then I can use this line instead of writing it everytime so I get a cleaner script.

Regards,

Humper

[center][/center]

Link to comment
Share on other sites

There are many Diablo Bots here... Have you search for them?

Here is my last contribution, I don't do games (overall)

While 1
    Sleep(1000)
    REPEATING_COMMAND_1()
    Do_RC
    Sleep(1000)
    REPEATING_COMMAND_2()

    Sleep(????)
WEnd

Func REPEATING_COMMAND_1()
    Click on x, y
    Click x, y send ^ a(ctrl)
    Read ini file
    Send line 1(from ini)
    Send {TAB}
    Send line 2(from ini)
    Send {ENTER}
    Read ini line 3, (How many boxes pressed)
EndFunc   ;==>REPEATING_COMMAND_1

Func Do_RC_2()
    ; do some stuff
EndFunc   ;==>Do_RC_2

Func REPEATING_COMMAND_2()
    MouseClick(x, y)
    MouseClick(x, y)
    Send(" {ENTER}")
    Sleep 300000
    Send("{ESC} {DOWN} {ENTER}")
    Send("{ESC}")
EndFunc   ;==>REPEATING_COMMAND_2


Func RC()
    Send(" {ENTER}") ;(Box 1)
    Do_RC_2()
    Send(" {RIGHT} {ENTER} ") ;(Box 2)
    Do_RC_2()
    Send(" {DOWN} {ENTER}") ; (Box 3)
    Do_RC_2()
    Send(" {DOWN} {RIGHT} {ENTER}") ; (Box 4)
    Do_RC_2()
    Send(" {DOWN} {DOWN} {ENTER}") ; (Box 5)
    Do_RC_2()
    Send(" {DOWN} {DOWN} {RIGHT} {ENTER}") ; (BOX 6)
    Do_RC_2()
    Send(" {DOWN} {DOWN} {DOWN} {ENTER}") ; (BOX 7)
    Do_RC_2()
    Send(" {DOWN} {DOWN} {DOWN} {RIGHT} {ENTER}") ; (BOX 8)
    Do_RC_2()
EndFunc   ;==>RC
Send(" {ESC}

8)

NEWHeader1.png

Link to comment
Share on other sites

Oh, your quick on this ^^

Okey made some minor changes.

So now its logging in atleast by reading the ini, same with the path.

;Pre info
$argument = " -w -nohide -ns"
$Account = IniRead("Settings.ini", "Section 1", "Account", "Default")
$Password = IniRead("Settings.ini", "Section 1", "Password", "Default")
$NrCharacters = IniRead("Settings.ini", "Selection 1", "NrCharacters", "Default")
$Path = IniRead("Settings.ini", "Path", "Diablo II path", "Default")

MsgBox(0, "Diablo II", "Hello, this is a Diablo II character checker!")
Run($Path & $argument)
WinWaitActive("Diablo II")
WinMove ( "Diablo II", "", 0, 0 )
Sleep (500)
;Enter to get to main screen
Send ("{ENTER}")
;Bnet
MouseClick ( "left", 420, 372 )
;Mark the login name
Sleep (2000)
MouseClick ( "left", 474, 358, 2)
Send ($Account, 1)
Send ("{TAB}")
Send ($Password, 1)
Sleep (500)
Send ("{ENTER}")

[Path]
Diablo II path="D:\Program\Diablo II\Diablo II.exe"

[Section 1]
Account=
Password=
NrCharacters=

Okey but now, how do I do the other thing I asked:

Making a selection I want to repeat

Also, is it possible to fix so I can add more accounts to the ini without changing the script?

I got more questions but I ask later ^_^

[center][/center]

Link to comment
Share on other sites

Yes, login + character enter random game on every character.

Thanks great.

Now I know how to use:

if

else

func

FileReadLine

But I need still some help.

Also is it possible for the program to create an window that asks for all the info and creates a settings.ini file

First it asks for path, so then it create the file settings.ini (in the same folder as script) and write:

[Path]

Diablo II path="*What he/she wrote*"

And more but I just need to know one to make more.

This is turning out better then I thought it would, I start scripting the rest ready.

EDIT: Okey, I got it working as I want.

Now I just need help with those other things.

;Pre info
$argument = " -w -nohide -ns"
$Account = IniRead("Settings.ini", "Section 1", "Account", "Default")
$Password = IniRead("Settings.ini", "Section 1", "Password", "Default")
$Nr_Characters = IniRead("Settings.ini", "Selection 1", "Nr_Characters", "Default")
$Path = IniRead("Settings.ini", "Path", "Diablo II path", "Default")

MsgBox(0, "Diablo II", "Hello, this is a Diablo II character checker!")
Run($Path & $argument)
WinWaitActive("Diablo II")
WinMove ( "Diablo II", "", 0, 0 )
Sleep (500)

;Enter to get to main screen
Send ("{ENTER}")
;Bnet
MouseClick ( "left", 420, 372 )
;Mark the login name
Sleep (3000)
MouseClick ( "left", 474, 358, 2)
Send ($Account, 1)
Send ("{TAB}")
Sleep (700)
Send ($Password, 1)
Sleep (1000)
Send ("{ENTER}")
Sleep (2000)
;Login complite


$readusrspot = FileReadLine ("Settings.ini",8)
if $readusrspot = 1 Then
    achar ()
Else
    if $readusrspot = 2 Then
    achar ()
    bchar ()
    Else
    if $readusrspot = 3 Then
    achar ()
    bchar ()
    cchar ()        
    Else
    if $readusrspot = 4 Then
    achar ()
    bchar ()
    cchar ()
    dchar ()        
    Else
    if $readusrspot = 5 Then
    achar ()
    bchar ()        
    cchar ()
    dchar ()
    echar ()        
    Else
    if $readusrspot = 6 Then
    achar ()
    bchar ()
    cchar ()
    dchar ()
    echar ()
    fchar ()        
    Else
    if $readusrspot = 7 Then
    achar ()
    bchar ()        
    cchar ()        
    dchar ()        
    echar ()        
    fchar ()        
    gchar ()        
    Else
    if $readusrspot = 8 Then
    achar ()
    bchar ()
    cchar ()
    dchar ()
    echar ()
    fchar ()
    gchar ()
    hchar ()        
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf

Func achar ()
        MouseClick("left",211,174,1,1)
    Sleep (200)
    Send ("{ENTER}")
    Sleep (3000)
;Press join game
    MouseClick ( "left", 709, 484 )
    Sleep (2000)
;Double click on game
    MouseClick ( "left", 504, 251, 2 )
;How long to wait in game
    Sleep (5000)
    Send ( "{ESC}" )
    Sleep (200)
    Send ( "{UP}" )
    Sleep (200)
    Send ( "{ENTER}" )
    Sleep (1000)
    Send ( "{ESC}" )
    Sleep (3000)
EndFunc
Func bchar ()
    MouseClick("left",415,164,1,1)
    Sleep (200)
    Send ("{ENTER}")
    Sleep (3000)
;Press join game
    MouseClick ( "left", 709, 484 )
    Sleep (2000)
;Double click on game
    MouseClick ( "left", 504, 251, 2 )
;How long to wait in game
    Sleep (5000)
    Send ( "{ESC}" )
    Sleep (200)
    Send ( "{UP}" )
    Sleep (200)
    Send ( "{ENTER}" )
    Sleep (1000)
    Send ( "{ESC}" )
    Sleep (3000)
EndFunc
Func cchar ()
    MouseClick("left",229,257,1,1)
    Sleep (200)
    Send ("{ENTER}")
    Sleep (3000)
;Press join game
    MouseClick ( "left", 709, 484 )
    Sleep (2000)
;Double click on game
    MouseClick ( "left", 504, 251, 2 )
;How long to wait in game
    Sleep (5000)
    Send ( "{ESC}" )
    Sleep (200)
    Send ( "{UP}" )
    Sleep (200)
    Send ( "{ENTER}" )
    Sleep (1000)
    Send ( "{ESC}" )
    Sleep (3000)
EndFunc
Func dchar ()
    MouseClick("left",415,253,1,1)
    Sleep (200)
    Send ("{ENTER}")
    Sleep (3000)
;Press join game
    MouseClick ( "left", 709, 484 )
    Sleep (2000)
;Double click on game
    MouseClick ( "left", 504, 251, 2 )
;How long to wait in game
    Sleep (5000)
    Send ( "{ESC}" )
    Sleep (200)
    Send ( "{UP}" )
    Sleep (200)
    Send ( "{ENTER}" )
    Sleep (1000)
    Send ( "{ESC}" )
    Sleep (3000)
EndFunc
Func echar ()
    MouseClick("left",177,341,1,1)
    Sleep (200)
    Send ("{ENTER}")
    Sleep (3000)
;Press join game
    MouseClick ( "left", 709, 484 )
    Sleep (2000)
;Double click on game
    MouseClick ( "left", 504, 251, 2 )
;How long to wait in game
    Sleep (5000)
    Send ( "{ESC}" )
    Sleep (200)
    Send ( "{UP}" )
    Sleep (200)
    Send ( "{ENTER}" )
    Sleep (1000)
    Send ( "{ESC}" )
    Sleep (3000)
EndFunc
Func fchar ()
    MouseClick("left",408,341,1,1)
    Sleep (200)
    Send ("{ENTER}")
    Sleep (3000)
;Press join game
    MouseClick ( "left", 709, 484 )
    Sleep (2000)
;Double click on game
    MouseClick ( "left", 504, 251, 2 )
;How long to wait in game
    Sleep (5000)
    Send ( "{ESC}" )
    Sleep (200)
    Send ( "{UP}" )
    Sleep (200)
    Send ( "{ENTER}" )
    Sleep (1000)
    Send ( "{ESC}" )
    Sleep (3000)
EndFunc
Func gchar ()
    MouseClick("left",161,427,1,1)
    Sleep (200)
    Send ("{ENTER}")
    Sleep (3000)
;Press join game
    MouseClick ( "left", 709, 484 )
    Sleep (2000)
;Double click on game
    MouseClick ( "left", 504, 251, 2 )
;How long to wait in game
    Sleep (5000)
    Send ( "{ESC}" )
    Sleep (200)
    Send ( "{UP}" )
    Sleep (200)
    Send ( "{ENTER}" )
    Sleep (1000)
    Send ( "{ESC}" )
    Sleep (3000)
EndFunc
Func hchar ()
    MouseClick("left",438,431,1,1)
    Sleep (200)
    Send ("{ENTER}")
    Sleep (3000)
;Press join game
    MouseClick ( "left", 709, 484 )
    Sleep (2000)
;Double click on game
    MouseClick ( "left", 504, 251, 2 )
;How long to wait in game
    Sleep (5000)
    Send ( "{ESC}" )
    Sleep (200)
    Send ( "{UP}" )
    Sleep (200)
    Send ( "{ENTER}" )
    Sleep (1000)
    Send ( "{ESC}" )
    Sleep (3000)
EndFunc

Settings.ini

[Path]
Diablo II path="D:\Program\Diablo II\Diablo II.exe"

[Section 1]
Account=asdasd
Password=12312
Nr_Characters:
3

EDIT2: Okey I changed so the script is shorter but I havn't tried it yet because I got temporarly banned because I joined and left to many games.

But I wonder if its possible to let it wait until its connected to bnet instead of having it time based.

Same for all thing, because time based doesn't really make it compatable for all machines.

Edited by Humper

[center][/center]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...