Jump to content

Y Cord -10 Each Loop


 Share

Recommended Posts

How can I simplify this script? i want the y cord to -10 each time it loops.

also for the scroll function that im gonna add in soon, how do i make it detect so that it scrolls one single page and won't scroll too little or less?

MouseMove(959, 209, 1)
Sleep (200)
MouseClick("primary")
Sleep (200)
MouseClick("primary")
Sleep (200)
MouseMove(897, 300, 1) ;y coord at 300
Sleep (200)
MouseClick("primary")
Sleep (200)
MouseMove(909, 680, 1) 
Sleep (200)
MouseClick("primary") 
Sleep (200)
MouseMove(643, 446, 1) ;send
;loop again

MouseMove(959, 209, 1)
Sleep (200)
MouseClick("primary")
Sleep (200)
MouseClick("primary")
Sleep (200)
MouseMove(897, 290, 1) ;y coord was at 300, minus 10 = 290
Sleep (200)
MouseClick("primary")
Sleep (200)
MouseMove(909, 680, 1) 
Sleep (200)
MouseClick("primary") 
Sleep (200)
MouseMove(643, 446, 1) ;send
;loop again

MouseMove(959, 209, 1)
Sleep (200)
MouseClick("primary")
Sleep (200)
MouseClick("primary")
Sleep (200)
MouseMove(897, 280, 1) ;y coord was at 290, minus 10 = 280
Sleep (200)
MouseClick("primary")
Sleep (200)
MouseMove(909, 680, 1) 
Sleep (200)
MouseClick("primary") 
Sleep (200)
MouseMove(643, 446, 1) ;send
;loop again

MouseMove(959, 209, 1)
Sleep (200)
MouseClick("primary")
Sleep (200)
MouseClick("primary")
Sleep (200)
MouseMove(897, 270, 1) ;y coord was at 280, minus 10 = 270
Sleep (200)
MouseClick("primary")
Sleep (200)
MouseMove(909, 680, 1) 
Sleep (200)
MouseClick("primary") 
Sleep (200)
MouseMove(643, 446, 1) ;send
;loop again and again ... etc

ty

Link to comment
Share on other sites

How can I simplify this script? i want the y cord to -10 each time it loops.

also for the scroll function that im gonna add in soon, how do i make it detect so that it scrolls one single page and won't scroll too little or less?

I'm not entirely sure what you want, but maybe something like this?

Dim $index = 0

While $Subtract <= 300
$Subtract = $index*10
MouseClick("primary", 959, 209, 2, 1)
Sleep (400)
MouseClick("primary", 897, 300 - $subtract)
Sleep (400)
MouseClick("primary", 909, 680) 
Sleep (400)
MouseClick("primary",643, 446) 
Sleep (400)
$index += 1
WEnd
Edited by Paulie
Link to comment
Share on other sites

Your script can be simplified to:

For $y = 300 To 0 Step -10 ;starts at $y = 300, then deducts 10 until 0 is reached.
    MouseMove(959, 209, 1)
    Sleep (200)
    MouseClick("primary")
    Sleep (200)
    MouseClick("primary")
    Sleep (200)
    MouseMove(897, $y, 1) ;use $y here
    Sleep (200)
    MouseClick("primary")
    Sleep (200)
    MouseMove(909, 680, 1) 
    Sleep (200)
    MouseClick("primary") 
    Sleep (200)
    MouseMove(643, 446, 1) ;send
Next

You can also remove the MouseMoves and use the coords in the MouseClicks. If you are using this to interact with an applications controls you should look into using ControlClick instead.

For your other question: I can't really answer that without knowing what you are trying to scroll and how the scroll is initiated,

P.s. Try not to bump your topics within 24h, but you might not have the edit option available yet.

Link to comment
Share on other sites

Your script can be simplified to:

For $y = 300 To 0 Step -10 ;starts at $y = 300, then deducts 10 until 0 is reached.
    MouseMove(959, 209, 1)
    Sleep (200)
    MouseClick("primary")
    Sleep (200)
    MouseClick("primary")
    Sleep (200)
    MouseMove(897, $y, 1) ;use $y here
    Sleep (200)
    MouseClick("primary")
    Sleep (200)
    MouseMove(909, 680, 1) 
    Sleep (200)
    MouseClick("primary") 
    Sleep (200)
    MouseMove(643, 446, 1) ;send
Next

You can also remove the MouseMoves and use the coords in the MouseClicks. If you are using this to interact with an applications controls you should look into using ControlClick instead.

For your other question: I can't really answer that without knowing what you are trying to scroll and how the scroll is initiated,

P.s. Try not to bump your topics within 24h, but you might not have the edit option available yet.

so after getting to 0, it stops but how can I make it start again from the 2nd part of my script?

Then vice versa and from the 2nd part of my script back to the first part, etc

ie) when it gets to 0, it goes to line 99, then when it gets to line 101, it goes back to line1

Edited by ctimeless
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...