Sign in to follow this  
Followers 0
BobiusMaximus

Loops?

18 posts in this topic

Yeh, basically I'm working on a prog right now.

I've done the bulk of it, but now I'm stuck.

I need to have loop which clicks somewhere, types something, clicks somewhere else then waits a bit before starting again.

I have the co-ordinates and I've got the script ready to go in the loop, however, I also need the loop to stop when I push a button such as F10 and I'm stuck.

Help please?

-Bob


Photoshop User and Noob AutoIt user.

Share this post


Link to post
Share on other sites



Yeh, basically I'm working on a prog right now.

I've done the bulk of it, but now I'm stuck.

I need to have loop which clicks somewhere, types something, clicks somewhere else then waits a bit before starting again.

I have the co-ordinates and I've got the script ready to go in the loop, however, I also need the loop to stop when I push a button such as F10 and I'm stuck.

Help please?

-Bob

look up hotkeyset in the help file....

 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

Hi,

have a look at AU3Record and into the helpfile for HotkeySet and While...wend or For..Next or Do...until.

So long,

Mega

P.S. May post the post, too.


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Look at _IsPressed()? Or as beerman said, HotKeySet()


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

I can set hotkeys already, it's the Loop bit I'm confused about ^^

And I'l have a look at those other ones ^^

-Bob


Photoshop User and Noob AutoIt user.

Share this post


Link to post
Share on other sites

Can we see some code?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Sure:

#Include <Misc.au3>

#cs ----------------------------------------------------------------------------

 Bot for Playing field 2 found at http://hallpass.com/media/playingfield2.html
 By BobiusMaximus
 
 To use this bot start the game then scroll your window up to the top.
 This has been designed using a 1024*768 Resoloution monitor and 'Opera' browser so may not work on others.
 
#ce ----------------------------------------------------------------------------

If WinExists("Playing Field 2 -")Then
    WinActivate("Playing Field 2 -")
    MouseClickDrag("left", 1020, 365, 1020, 440)
    MouseClick("left", 321, 623)
    Send("crazymonkey")
    MouseClick("left", 445, 623)
    MouseClick("left", 620, 360)
EndIf

Do
    MouseClick("left", 321, 623)
    Send("consume")
    MouseClick("left", 445, 623)
    Sleep(1500)
Until

-Bob


Photoshop User and Noob AutoIt user.

Share this post


Link to post
Share on other sites

Hi,

looks not that wrong, but Do ... until ??? what? You missed that.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Exactly, I can't figure out how to end it rofl ^^


Photoshop User and Noob AutoIt user.

Share this post


Link to post
Share on other sites

#Include <Misc.au3>

#cs ----------------------------------------------------------------------------

 Bot for Playing field 2 found at http://hallpass.com/media/playingfield2.html
 By BobiusMaximus
 
 To use this bot start the game then scroll your window up to the top.
 This has been designed using a 1024*768 Resoloution monitor and 'Opera' browser so may not work on others.
 
#ce ----------------------------------------------------------------------------

HotKeySet("{ESC}", "Terminate")
HotKeySet("{f1}", "Start")
HotKeySet("{f2}", "Stop")

While 1
    Sleep(100)
WEnd

Func Terminate()
    Exit 0
EndFunc

Func Start()
If WinExists("Playing Field 2 -")Then
    WinActivate("Playing Field 2 -")
    MouseClickDrag("left", 1020, 365, 1020, 440)
    MouseClick("left", 321, 623)
    Send("crazymonkey")
    MouseClick("left", 445, 623)
    MouseClick("left", 620, 360)
EndIf

while 1
    MouseClick("left", 321, 623)
    Send("consume")
    MouseClick("left", 445, 623)
    Sleep(1500)
wend
EndFunc

Func Stop()
    Exitloop
EndFunc


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

That doesn't work o.O

Anyway, I improved the script a little so you don't have to do anything to start it(so just leave the window as is then run script)

#Include <Misc.au3>

#cs ----------------------------------------------------------------------------

 Bot for Playing field 2 found at http://hallpass.com/media/playingfield2.html
 By BobiusMaximus
 
 This has been designed using a 1024*768 Resoloution monitor and 'Opera' browser so may not work on others.
 
#ce ----------------------------------------------------------------------------

If WinExists("Playing Field 2 -")Then
    WinActivate("Playing Field 2 -")
    MouseClickDrag("left", 1020, 365, 1020, 440)
    MouseClick("left", 498, 464)
    MouseClick("left", 506, 623)
    Sleep(1500)
    MouseClick("left", 456, 610)
    Sleep(7000)
    MouseClick("left", 461, 429)
    Sleep(1500)
    MouseClick("left", 321, 623)
    Send("crazymonkey")
    MouseClick("left", 445, 623)
    MouseClick("left", 620, 360)
EndIf

Do
    MouseClick("left", 321, 623)
    Send("consume")
    MouseClick("left", 445, 623)
    Sleep(2000)
Until

Can you try adding it again to that one and see if it works then? ;)

-Bob


Photoshop User and Noob AutoIt user.

Share this post


Link to post
Share on other sites

since your a new person.... on the script i reconfigured for you. you have to hit the f1 key on your keyboard to get it started, and hit the f2 key to stop it. the escape key to exit the program......


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

It says there is an error in line 44 whenever I try to run that...

Edit:

I got my script working, but it doesn't stop when I push '0' ;)

#Include <Misc.au3>

#cs ----------------------------------------------------------------------------

 Bot for Playing field 2 found at http://hallpass.com/media/playingfield2.html
 By BobiusMaximus
 
 This has been designed using a 1024*768 Resoloution monitor and 'Opera' browser so may not work on others.
 
#ce ----------------------------------------------------------------------------

If WinExists("Playing Field 2 -")Then
    WinActivate("Playing Field 2 -")
    MouseClickDrag("left", 1020, 365, 1020, 440)
    MouseClick("left", 498, 464)
    MouseClick("left", 506, 623)
    Sleep(1500)
    MouseClick("left", 456, 610)
    Sleep(7000)
    MouseClick("left", 461, 429)
    Sleep(1500)
    MouseClick("left", 321, 623)
    Send("crazymonkey")
    MouseClick("left", 445, 623)
    MouseClick("left", 620, 360)
EndIf

Do
    MouseClick("left", 321, 623)
    Send("consume")
    MouseClick("left", 445, 623)
    Sleep(2000)
Until _IsPressed("0")

-Bob

Edited by BobTheLeetHaxx0r

Photoshop User and Noob AutoIt user.

Share this post


Link to post
Share on other sites

#Include <Misc.au3>

#cs ----------------------------------------------------------------------------

Bot for Playing field 2 found at http://hallpass.com/media/playingfield2.html
By BobiusMaximus

To use this bot start the game then scroll your window up to the top.
This has been designed using a 1024*768 Resoloution monitor and 'Opera' browser so may not work on others.

#ce ----------------------------------------------------------------------------
Global $quit
HotKeySet("{ESC}", "Terminate")
HotKeySet("{f1}", "Start")
HotKeySet("{f2}", "Stop")

While 1
    Sleep(100)
WEnd

Func Terminate()
    Exit 0
EndFunc

Func Start()
$quit = 1 
If WinExists("Playing Field 2 -")Then
    WinActivate("Playing Field 2 -")
    MouseClickDrag("left", 1020, 365, 1020, 440)
    MouseClick("left", 321, 623)
    Send("crazymonkey")
    MouseClick("left", 445, 623)
    MouseClick("left", 620, 360)
EndIf

while $quit = 1
    MouseClick("left", 321, 623)
    Send("consume")
    MouseClick("left", 445, 623)
    Sleep(1500)
wend
EndFunc

Func Stop()
    $quit = 0
EndFunc

sorry try this...


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

It says there is an error in line 44 whenever I try to run that...

Edit:

I got my script working, but it doesn't stop when I push '0' ;)

#Include <Misc.au3>

#cs ----------------------------------------------------------------------------

 Bot for Playing field 2 found at http://hallpass.com/media/playingfield2.html
 By BobiusMaximus
 
 This has been designed using a 1024*768 Resoloution monitor and 'Opera' browser so may not work on others.
 
#ce ----------------------------------------------------------------------------

If WinExists("Playing Field 2 -")Then
    WinActivate("Playing Field 2 -")
    MouseClickDrag("left", 1020, 365, 1020, 440)
    MouseClick("left", 498, 464)
    MouseClick("left", 506, 623)
    Sleep(1500)
    MouseClick("left", 456, 610)
    Sleep(7000)
    MouseClick("left", 461, 429)
    Sleep(1500)
    MouseClick("left", 321, 623)
    Send("crazymonkey")
    MouseClick("left", 445, 623)
    MouseClick("left", 620, 360)
EndIf

Do
    MouseClick("left", 321, 623)
    Send("consume")
    MouseClick("left", 445, 623)
    Sleep(2000)
Until _IsPressed("0")oÝ÷ Øþ«¨µëhër¢êð¢¹"kÊØb±«­¢+Ø%¹±Õ±Ðí5¥Í¹ÔÌÐì((Ì´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´((   ½Ð½ÈA±å¥¹¥±È½Õ¹Ð¡ÑÑÀè¼½¡±±ÁÍ̹½´½µ¥½Á±å¥¹¥±È¹¡Ñµ°(  ä  ½¥ÕÍ5᥵ÕÌ((Q¡¥Ì¡Ì¸Í¥¹ÕÍ¥¹ÄÀÈШÜØàIͽ±½ÕÑ¥½¸µ½¹¥Ñ½È¹Ìäí=ÁÉÌäìɽÝÍÈͼµä¹½Ðݽɬ½¸½Ñ¡É̸((´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´()%]¥¹á¥ÍÑÌ ÅÕ½ÐíA±å¥¹¥±È´ÅÕ½Ðì¥Q¡¸(]¥¹Ñ¥ÙÑ ÅÕ½ÐíA±å¥¹¥±È´ÅÕ½Ðì¤(%5½ÕÍ
±¥­É ÅÕ½Ðí±ÐÅÕ½Ðì°ÄÀÈÀ°ÌØÔ°ÄÀÈÀ°ÐÐÀ¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°Ðäà°ÐØФ(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÔÀØ°ØÈ̤(%M±À ÄÔÀÀ¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÐÔØ°ØÄÀ¤(%M±À ÜÀÀÀ¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÐØÄ°ÐÈä¤(%M±À ÄÔÀÀ¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÌÈÄ°ØÈ̤(%M¹ ÅÕ½ÐíÉéåµ½¹­äÅÕ½Ðì¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÐÐÔ°ØÈ̤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ØÈÀ°ÌØÀ¤)¹%()¼(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÌÈÄ°ØÈ̤(%M¹ ÅÕ½Ðí½¹ÍÕµÅÕ½Ðì¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÐÐÔ°ØÈ̤(%M±À ÈÀÀÀ¤)U¹Ñ¥°}%ÍAÉÍÍ ÅÕ½ÐìÌÀÅÕ½Ðì¤ôÄ
Edited by beerman

 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

to get your working try this

#Include <Misc.au3>

#cs ----------------------------------------------------------------------------

 Bot for Playing field 2 found at http://hallpass.com/media/playingfield2.html
 By BobiusMaximus
 
 This has been designed using a 1024*768 Resoloution monitor and 'Opera' browser so may not work on others.
 
#ce ----------------------------------------------------------------------------

If WinExists("Playing Field 2 -")Then
    WinActivate("Playing Field 2 -")
    MouseClickDrag("left", 1020, 365, 1020, 440)
    MouseClick("left", 498, 464)
    MouseClick("left", 506, 623)
    Sleep(1500)
    MouseClick("left", 456, 610)
    Sleep(7000)
    MouseClick("left", 461, 429)
    Sleep(1500)
    MouseClick("left", 321, 623)
    Send("crazymonkey")
    MouseClick("left", 445, 623)
    MouseClick("left", 620, 360)
EndIf

Do
    MouseClick("left", 321, 623)
    Send("consume")
    MouseClick("left", 445, 623)
    Sleep(2000)
Until _IsPressed("30") = 1
yeah yours works, but keep in mind you have a 2 second delay so pressing the 0 key will not be instant exit....so you might have to hit several times...

 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

yeah yours works, but keep in mind you have a 2 second delay so pressing the 0 key will not be instant exit....so you might have to hit several times...

To get instant response on the 0 you could something like this:

Func Start()
    $quit = 1
    If WinExists("Playing Field 2 -") Then
        WinActivate("Playing Field 2 -")
        MouseClickDrag("left", 1020, 365, 1020, 440)
        MouseClick("left", 321, 623)
        Send("crazymonkey")
        MouseClick("left", 445, 623)
        MouseClick("left", 620, 360)
    EndIf

    While $quit = 1
        MouseClick("left", 321, 623)
        Send("consume")
        MouseClick("left", 445, 623)
        ; sleep 2 secs 
        $T = TimerInit()
        While TimerDiff($T) < 2000 And $quit = 1
            Sleep(10)
        WEnd
    WEnd
EndFunc   ;==>Start

Func Stop()
    $quit = 0
EndFunc   ;==>Stop
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Well, I reckon I don't need the 2second wait there now I've been trying it out, how could I manage that?

-Bob


Photoshop User and Noob AutoIt user.

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