| View previous topic :: View next topic |
| Author |
Message |
Bytales
Joined: 06 Sep 2008 Posts: 82
|
Posted: Sat Sep 06, 2008 2:14 pm Post subject: Displaying msgbox when breaking loop |
|
|
I'm new to this software and i have much to learn.
I must say it is amazing.
But i need a function which i don't think it is implement.
that;s why im asking to see if it is
Is there a way to display a message box when a loop is broken.
for instance i'm making a loop that starts when i press control+z.
If i press control+z again the loop brokes.
I found this example on the net.
Now, is there a way to display a msgbox when the breaking occurs ? |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 666 Location: MN, USA
|
Posted: Sat Sep 06, 2008 2:35 pm Post subject: |
|
|
Replace the break in your loop with GoTo or precede it with a function call to a MsgBox. _________________ http://autohotkey.net/~jaco0646/ |
|
| Back to top |
|
 |
Slanter
Joined: 28 May 2008 Posts: 397 Location: Minnesota, USA
|
Posted: Sat Sep 06, 2008 8:38 pm Post subject: |
|
|
maybe put the msgbox after the loop? | Code: | Loop, 5
A++
MsgBox The loop ended! |
_________________ Unless otherwise stated, all code is untested
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination. |
|
| Back to top |
|
 |
Bytales
Joined: 06 Sep 2008 Posts: 82
|
Posted: Sat Sep 06, 2008 10:06 pm Post subject: |
|
|
| Will try, thanks for info |
|
| Back to top |
|
 |
Bytales
Joined: 06 Sep 2008 Posts: 82
|
Posted: Sun Sep 07, 2008 12:18 pm Post subject: |
|
|
| Slanter wrote: | maybe put the msgbox after the loop? | Code: | Loop, 5
A++
MsgBox The loop ended! |
|
This doesn't work because the message box will not appear after the loop.
My loop is made with a large body, and break is inserted at almost every step. So the message box needs to be related to the break !
The whole script is bascilay starting the loop at a keystroke. If i hit that keystroke again, which will break the loop, the mesgbox must appear, and once i click ok on the message box, the loop musn't start again ! |
|
| Back to top |
|
 |
Serenity
Joined: 07 Nov 2004 Posts: 1276
|
Posted: Sun Sep 07, 2008 12:32 pm Post subject: |
|
|
Put the msgbox before the break, eg:
| Code: | a::
loop ; loop will keep looping until key is released
{
tooltip % A_Index
getkeystate, state, a, p
if state = u ; condition of break
{
tooltip
msgbox Hello!
break
}
}
return |
_________________ "Anything worth doing is worth doing slowly." - Mae West
 |
|
| Back to top |
|
 |
|