| View previous topic :: View next topic |
| Author |
Message |
biatche
Joined: 23 Feb 2008 Posts: 59
|
Posted: Sun Apr 20, 2008 8:35 am Post subject: [??] How do I repeat a function until demand is reached |
|
|
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 |
|
 |
biatche
Joined: 23 Feb 2008 Posts: 59
|
Posted: Sun Apr 20, 2008 8:59 am Post subject: |
|
|
| ok I used a simple loop break continue.. seem to work. if anyone got a better idea please let me know... |
|
| Back to top |
|
 |
Epuls56
Joined: 19 Apr 2008 Posts: 33
|
Posted: Sun Apr 20, 2008 3:39 pm Post subject: |
|
|
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 |
|
 |
Epuls56
Joined: 19 Apr 2008 Posts: 33
|
Posted: Sun Apr 20, 2008 3:40 pm Post subject: |
|
|
| Wait let me read the help file. |
|
| Back to top |
|
 |
Epuls56
Joined: 19 Apr 2008 Posts: 33
|
Posted: Sun Apr 20, 2008 3:43 pm Post subject: |
|
|
| Thats not it, I will have to search a little bit. Sorry -_- |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 553 Location: MN, USA
|
Posted: Sun Apr 20, 2008 5:01 pm Post subject: |
|
|
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 |
|
 |
biatche
Joined: 23 Feb 2008 Posts: 59
|
Posted: Sun Apr 20, 2008 10:41 pm Post subject: |
|
|
| Thank you jaco, mine's similar to yours, except I used unnecessary ELSE |
|
| Back to top |
|
 |
|