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 

[??] How do I repeat a function until demand is reached

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



Joined: 23 Feb 2008
Posts: 59

PostPosted: Sun Apr 20, 2008 8:35 am    Post subject: [??] How do I repeat a function until demand is reached Reply with quote

Sorry I'm not very good at coding in general.

Say I have:

Code:
InputBox input_password,%Title% v%Version%,%Message%, , 520, 290


Now, I want input_password to match something, if it doesn't match, I want it to go back to the inputbox until the correct password is entered or the user press cancel.

What's the best way of doing this? I'm sure there are several ways.
Back to top
View user's profile Send private message
biatche



Joined: 23 Feb 2008
Posts: 59

PostPosted: Sun Apr 20, 2008 8:59 am    Post subject: Reply with quote

ok I used a simple loop break continue.. seem to work. if anyone got a better idea please let me know...
Back to top
View user's profile Send private message
Epuls56



Joined: 19 Apr 2008
Posts: 33

PostPosted: Sun Apr 20, 2008 3:39 pm    Post subject: Reply with quote

Hmmm I'm not 100% sure this is correct because I did this about a year ago but:


Code:

gIb:
Inputbox input_password,%Title% v%Version%,%Message%, ,520, 290
If ErrorLevel

If (Password), (Where you want it to go)
If [Can't remember this part], Gosub,Ib
Back to top
View user's profile Send private message
Epuls56



Joined: 19 Apr 2008
Posts: 33

PostPosted: Sun Apr 20, 2008 3:40 pm    Post subject: Reply with quote

Wait let me read the help file.
Back to top
View user's profile Send private message
Epuls56



Joined: 19 Apr 2008
Posts: 33

PostPosted: Sun Apr 20, 2008 3:43 pm    Post subject: Reply with quote

Thats not it, I will have to search a little bit. Sorry -_-
Back to top
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 553
Location: MN, USA

PostPosted: Sun Apr 20, 2008 5:01 pm    Post subject: Reply with quote

I agree that a loop is the simplest way. Here's my version (you didn't post yours).
Code:
Loop
{
 InputBox, password, Title, Enter your password:%msg%, Hide, 200, 150
 If ErrorLevel
 {
  MsgBox, You clicked Cancel.
  ExitApp
 }
 If password = CorrectPassword
 {
  MsgBox, That is correct!
  break
 }
 msg = `n`nIncorrect password.
}
MsgBox, You broke the loop by entering the correct password.
;more code here

_________________
http://autohotkey.net/~jaco0646/
Back to top
View user's profile Send private message Visit poster's website
biatche



Joined: 23 Feb 2008
Posts: 59

PostPosted: Sun Apr 20, 2008 10:41 pm    Post subject: Reply with quote

Thank you jaco, mine's similar to yours, except I used unnecessary ELSE
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   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