AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A_Index inside two loop's?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
TheDanishDragon



Joined: 15 Oct 2008
Posts: 42

PostPosted: Sun Mar 22, 2009 12:19 am    Post subject: A_Index inside two loop's? Reply with quote

I am currently about to make a dynamic script, and i need to know something about A_Index's behavior inside two loop's.

An exsample:
Code:

loop, 3 {
   Loop, 3{
      test = A_Index ;or %A_Index%, not the most inmportent part..
   }
}


what would test be?
_________________
Mr. HappyDude
Back to top
View user's profile Send private message
menaphus



Joined: 28 Nov 2008
Posts: 111
Location: United Kingdom

PostPosted: Sun Mar 22, 2009 12:39 am    Post subject: Reply with quote

Wouldnt that be the same as

Code:

Loop, 9
{
test = A_Index
}


also have you tryed returning the value of test yourself?
_________________
Adam
http://moourl.com/8w0tx
Back to top
View user's profile Send private message Send e-mail Visit poster's website
membersound



Joined: 07 Mar 2009
Posts: 80

PostPosted: Sun Mar 22, 2009 12:51 am    Post subject: Reply with quote

Well... what about
Code:
MsgBox, %test%
?

/e @menaphus: a loop9 would obviously not be the same I guess Shocked
Back to top
View user's profile Send private message
TheDanishDragon



Joined: 15 Oct 2008
Posts: 42

PostPosted: Sun Mar 22, 2009 1:51 am    Post subject: hmm.. Reply with quote

well,

1. the point is no to get 9 loops in total
2. i gues i could use msgbox, and ill try that Smile forgot all about that tecnique, because i havent coded ahk for some time now Sad

/TDD
_________________
Mr. HappyDude
Back to top
View user's profile Send private message
Guest






PostPosted: Sun Mar 22, 2009 2:18 am    Post subject: Reply with quote

Code:
Loop, 3 {
   temp := A_Index
   Loop, 3{
      msgbox % "OuterLoop: " temp "`nInner Loop: " A_Index
   }
   msgbox % A_Index
}

Something like this?
A_Index is taken from the loop it's in.
Notice how A_Index is taken from the outer loop once execution is out of the inner loop.
Back to top
TheDanishDragon



Joined: 15 Oct 2008
Posts: 42

PostPosted: Sun Mar 22, 2009 3:02 am    Post subject: Reply with quote

i notice that you use % A_Index or A_Index

whats the advantage of that, and whats the difference between:
1. A_Index
2. % A_Index
3. %A_Index%
_________________
Mr. HappyDude
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group