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 

Displaying msgbox when breaking loop

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



Joined: 06 Sep 2008
Posts: 82

PostPosted: Sat Sep 06, 2008 2:14 pm    Post subject: Displaying msgbox when breaking loop Reply with quote

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
View user's profile Send private message
jaco0646



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

PostPosted: Sat Sep 06, 2008 2:35 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Slanter



Joined: 28 May 2008
Posts: 397
Location: Minnesota, USA

PostPosted: Sat Sep 06, 2008 8:38 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Bytales



Joined: 06 Sep 2008
Posts: 82

PostPosted: Sat Sep 06, 2008 10:06 pm    Post subject: Reply with quote

Will try, thanks for info
Back to top
View user's profile Send private message
Bytales



Joined: 06 Sep 2008
Posts: 82

PostPosted: Sun Sep 07, 2008 12:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
Serenity



Joined: 07 Nov 2004
Posts: 1276

PostPosted: Sun Sep 07, 2008 12:32 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
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