Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

I want loop this code with 5 times, how



  • Please log in to reply
15 replies to this topic
261
  • Members
  • 9 posts
  • Last active: Jun 29 2013 07:51 PM
  • Joined: 03 Jun 2013
#NoEnv
#Warn

SendMode Event

CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, ToolTip, Screen

;#Persistent
loop, 5
{
	Run Dota 2.url
	
	SetTimer, T1, 100
	SetTimer, T10, 100

	T1: 
		...macro here !
	T10: 
		...macro here !
}
Return

This code only work once , then it stop . I want auto run it again 

I want this code run again again 5,6,7 times

pls help me, or give me KEYWORD

 

 

-sorry bad english--

 



Eedis
  • Members
  • 1775 posts
  • Last active: Aug 14 2015 06:33 PM
  • Joined: 12 Jun 2009
I think you might find Loop to be very helpful.
Loop 10                            ;The number is the amount of times the code is looped
{                                  ;This brace shows the beginning of the loop
    Msgbox, Hello world!           ;This is the code that will be executed
}                                  ;This brace shows the end of the loop

AutoHotkey state, the forum, Poly, and Drainx1. The short story.
I love my wife, my life, my atomic-match; for giving me the greatest gift a man could ask for, such a perfect and beautiful little girl.
9rjbjc.png

261
  • Members
  • 9 posts
  • Last active: Jun 29 2013 07:51 PM
  • Joined: 03 Jun 2013

I think you might find Loop to be very helpful.

Loop 10                            ;The number is the amount of times the code is looped
{                                  ;This brace shows the beginning of the loop
    Msgbox, Hello world!           ;This is the code that will be executed
}                                  ;This brace shows the end of the loop

thank u, but it only work once , no reload again sad.png

 

i want rejion a Game 5,6,7,8 ... times happy.png



Eedis
  • Members
  • 1775 posts
  • Last active: Aug 14 2015 06:33 PM
  • Joined: 12 Jun 2009
Well, did you try to incorporate another loop?

With this, you can run the script as many times you want by pressing CTRL+a. You can change the hotkey to anything you want.

#NoEnv
#Warn

SendMode Event

CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, ToolTip, Screen

;#Persistent
^a::                                ;Change this hotkey to anything you want it to be.
loop, 5
{
	Run Dota 2.url
	
	SetTimer, T1, 100
	SetTimer, T10, 100

	T1: 
		...macro here !
	T10: 
		...macro here !
}
Return

AutoHotkey state, the forum, Poly, and Drainx1. The short story.
I love my wife, my life, my atomic-match; for giving me the greatest gift a man could ask for, such a perfect and beautiful little girl.
9rjbjc.png

261
  • Members
  • 9 posts
  • Last active: Jun 29 2013 07:51 PM
  • Joined: 03 Jun 2013

Well, did you try to incorporate another loop?

With this, you can run the script as many times you want by pressing CTRL+a. You can change the hotkey to anything you want.
 

#NoEnv
#Warn

SendMode Event

CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, ToolTip, Screen

;#Persistent
^a::                                ;Change this hotkey to anything you want it to be.
loop, 5
{
	Run Dota 2.url
	
	SetTimer, T1, 100
	SetTimer, T10, 100

	T1: 
		...macro here !
	T10: 
		...macro here !
}
Return

thank, but i want it AUTO Loop

do u know how :D



Eedis
  • Members
  • 1775 posts
  • Last active: Aug 14 2015 06:33 PM
  • Joined: 12 Jun 2009
Just change the value of how many times it loops. There is already a loop in your script. Right now, it loops 5 times, which to you counts as one 'run of the script'. So in that, since you want to run it say 5 times, just multiply the 5 by how many times yo want the script to run, which is 5 in this case. 5*5=25
If you want it to run 6 times 5*6=30 | 5*7=35 | 5*8=40 and so on. Also, I kept the hotkey in there so you can run it on command. If you don't want that, just delete the hotkey.
#NoEnv
#Warn

SendMode Event

CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, ToolTip, Screen

;#Persistent
^a::                                ;Change this hotkey to anything you want it to be.
loop, 25
{
	Run Dota 2.url
	
	SetTimer, T1, 100
	SetTimer, T10, 100

	T1: 
		...macro here !
	T10: 
		...macro here !
}
Return

AutoHotkey state, the forum, Poly, and Drainx1. The short story.
I love my wife, my life, my atomic-match; for giving me the greatest gift a man could ask for, such a perfect and beautiful little girl.
9rjbjc.png

261
  • Members
  • 9 posts
  • Last active: Jun 29 2013 07:51 PM
  • Joined: 03 Jun 2013

Just change the value of how many times it loops. There is already a loop in your script. Right now, it loops 5 times, which to you counts as one 'run of the script'. So in that, since you want to run it say 5 times, just multiply the 5 by how many times yo want the script to run, which is 5 in this case. 5*5=25
If you want it to run 6 times 5*6=30 | 5*7=35 | 5*8=40 and so on. Also, I kept the hotkey in there so you can run it on command. If you don't want that, just delete the hotkey.


see:

 

when i start this code , game on > next : some micro here > a last : game quit ... that all , it dont rejion game again :(

 

i want it reopen game again > micro > quit > game > micro > quit > .... 



Eedis
  • Members
  • 1775 posts
  • Last active: Aug 14 2015 06:33 PM
  • Joined: 12 Jun 2009

Could you post your full script that you're using? I see that you've truncated the script to post here. In your first post, you should have been more specific at what you were wanting. What game are you playing and what is it run in: Browser, third party program, etc?

 

Just noticed it was Dota 2... I don't really play Dota 2 so I don't know how the interface is laid out or how you join and quit games, but if you post your full code you're working with, I'll see what Ican do.


AutoHotkey state, the forum, Poly, and Drainx1. The short story.
I love my wife, my life, my atomic-match; for giving me the greatest gift a man could ask for, such a perfect and beautiful little girl.
9rjbjc.png

261
  • Members
  • 9 posts
  • Last active: Jun 29 2013 07:51 PM
  • Joined: 03 Jun 2013

Could you post your full script that you're using? I see that you've truncated the script to post here. In your first post, you should have been more specific at what you were wanting. What game are you playing and what is it run in: Browser, third party program, etc?

 

Just noticed it was Dota 2... I don't really play Dota 2 so I don't know how the interface is laid out or how you join and quit games, but if you post your full code you're working with, I'll see what Ican do.

thank, i want do some thing like : 

 

open nodepad -> write a few lines on it, macro mouse , .... -> close notepad -> open nopad - >> write a few lines above,macro mouse -> ....
 
I can choose the number of repetitions ( like : 2,3,4,5,6 .... 100 )
 
I want to repeat this process auto, I want to use it to Game.


Eedis
  • Members
  • 1775 posts
  • Last active: Aug 14 2015 06:33 PM
  • Joined: 12 Jun 2009

Could you post your current full script without excluding anything? Like I said, I wouldn't know the layout of the interface for the game so I can't really write the script. I noticed it your first post that you left out some of the script, which is implied with the '...Macro here' portion.


AutoHotkey state, the forum, Poly, and Drainx1. The short story.
I love my wife, my life, my atomic-match; for giving me the greatest gift a man could ask for, such a perfect and beautiful little girl.
9rjbjc.png

261
  • Members
  • 9 posts
  • Last active: Jun 29 2013 07:51 PM
  • Joined: 03 Jun 2013

Could you post your current full script without excluding anything? Like I said, I wouldn't know the layout of the interface for the game so I can't really write the script. I noticed it your first post that you left out some of the script, which is implied with the '...Macro here' portion.

#NoEnv
#Warn

SendMode Event

CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, ToolTip, Screen

#SingleInstance force
#Persistent
	Replay := "playdemo replays/209928703.dem"
	Run Dota 2.url
	
	SetTimer, T1, 100
	SetTimer, T10, 100

	T1: 
		Pixelgetcolor, Color, 750, 580
		if (Color = 0x3E3E3E)
		{
			Clipboard = % Replay ;view replay
			Click 750, 580
			sleep 500
			Send ^v
			Send {Enter}
			SetTimer, T1, Off
		}

	T10: 
		Pixelgetcolor, Color, 831, 344
		if (Color = 0x393B37)
		{	
			Clipboard = Exit ; quit game
			Send {F11}
			sleep 2000
			Send ^v
			Send {Enter}
			SetTimer, T10, Off
		}
Return



Eedis
  • Members
  • 1775 posts
  • Last active: Aug 14 2015 06:33 PM
  • Joined: 12 Jun 2009

Okay, so this is all based off of assumption. I'm going to make a list of what I think you're trying to do, please clear it up a bit.

 

I assume that you want to:

1. Start up the Dota 2 game and search for a specific replay.

2. Once the replay has finished, you want to exit the game.

3. Once the game is exitted, you want to wash-rinse-repeat.

 

I guess my question here is, do you want the game to restart AFTER BOTH labels were executed or after only one of them?

 

A very sloppy and quickly written work-around.

#NoEnv
#Warn

SendMode Event

CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, ToolTip, Screen

#SingleInstance force
#Persistent
    Replay := "playdemo replays/209928703.dem"
Loop 5
{
    Loop
    {
        Run Dota 2.url
        Pixelgetcolor, Color, 750, 580
        Pixelgetcolor, Color2, 831, 344
        if (Color = 0x3E3E3E)
        {
            Clipboard :=Replay ;view replay
            Click 750, 580
            sleep 500
            Send ^v
            Send {Enter}
        }


        if (Color2 = 0x393B37)
        {    
            Clipboard = Exit ; quit game
            Send {F11}
            sleep 2000
            Send ^v
            Send {Enter}
            Break
        }
    }
}

ESC::
ExitApp

AutoHotkey state, the forum, Poly, and Drainx1. The short story.
I love my wife, my life, my atomic-match; for giving me the greatest gift a man could ask for, such a perfect and beautiful little girl.
9rjbjc.png

Rijul Ahuja
  • Members
  • 763 posts
  • Last active: Nov 25 2013 10:16 AM
  • Joined: 14 Mar 2012

I think I understand what you want here.

Press Windows Key (the one to open up start menu using keyboard), and a to activate.

#NoEnv
#Warn
SendMode Event
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, ToolTip, Screen
return

#a::
InputBox,Var,% A_ScriptName, Enter the number of times to loop the code
loop, % Var
{
	Run Dota 2.url
	
	SetTimer, T1, 100
	SetTimer, T10, 100

	T1: 
		...macro here !
	T10: 
		...macro here !
}
Return

Hope it helps.


Abandon the forum. The community has decided in a democratic vote to leave this website because of inactive and perverse administration.

Very few of the contributing members remain here.


261
  • Members
  • 9 posts
  • Last active: Jun 29 2013 07:51 PM
  • Joined: 03 Jun 2013

 

Okay, so this is all based off of assumption. I'm going to make a list of what I think you're trying to do, please clear it up a bit.

 

I assume that you want to:

1. Start up the Dota 2 game and search for a specific replay.

2. Once the replay has finished, you want to exit the game.

3. Once the game is exitted, you want to wash-rinse-repeat.

 

I guess my question here is, do you want the game to restart AFTER BOTH labels were executed or after only one of them?

 

A very sloppy and quickly written work-around.


GowtnmW.png

 

U see :  this code call all dota2 same time >_< ... not 1>2>3>4>5



Eedis
  • Members
  • 1775 posts
  • Last active: Aug 14 2015 06:33 PM
  • Joined: 12 Jun 2009
✓  Best Answer
Yeah, sorry, put the Run command in the wrong loop. >.< Easy fix.
 
#NoEnv
#Warn

SendMode Event

CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, ToolTip, Screen

#SingleInstance force
#Persistent
    Replay := "playdemo replays/209928703.dem"
Loop 5
{
    Run Dota 2.url
    Loop
    {
        Pixelgetcolor, Color, 750, 580
        Pixelgetcolor, Color2, 831, 344
        if (Color = 0x3E3E3E)
        {
            Clipboard :=Replay ;view replay
            Click 750, 580
            sleep 500
            Send ^v
            Send {Enter}
        }


        if (Color2 = 0x393B37)
        {    
            Clipboard = Exit ; quit game
            Send {F11}
            sleep 2000
            Send ^v
            Send {Enter}
            Break
        }
    }
}

ESC::
ExitApp

AutoHotkey state, the forum, Poly, and Drainx1. The short story.
I love my wife, my life, my atomic-match; for giving me the greatest gift a man could ask for, such a perfect and beautiful little girl.
9rjbjc.png