Jump to content

Stop Func problem


Recommended Posts

hello, now i have a script and need it to stop it's function when "F3" is pressed.

but i don't know what's wrong

check that:

HotKeySet("{F2}", "MSG")
HotKeySet("{F3}", "xt")

Func MSG()
$chk = 1
while 1
MsgBox(0, "TEST", "1")
MsgBox(0, "TEST", "2")
MsgBox(0, "TEST", "3")
MsgBox(0, "TEST", "4")
MsgBox(0, "TEST", "5")
$chk = 0
wend
EndFunc ;==>MSG

Func xt()
$chk = 0
EndFunc ;==>xt

While 1
Sleep(200)
WEnd

EDIT: I want it stop wherever which msgbox running whether msg1 or msg2 etc..

Edited by Command3r

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

[font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font]

Link to comment
Share on other sites

HotKeySet("{F2}", "MSG")
HotKeySet("{F3}", "xt")

Global $chk

Func _DoStuff($lab, $val)
If $chk = 0 Then Return (-1)
MsgBox(0, $lab, $val)
If $chk = 0 Then Return (-1)

EndFunc ;==>_DoStuff

Func MSG()
$chk = 1
While 1

If _DoStuff("TEST", "1") = -1 Then ExitLoop
If _DoStuff("TEST", "2") = -1 Then ExitLoop
If _DoStuff("TEST", "3") = -1 Then ExitLoop
If _DoStuff("TEST", "4") = -1 Then ExitLoop
If _DoStuff("TEST", "5") = -1 Then ExitLoop
$chk = 0
WEnd
EndFunc ;==>MSG




Func xt()
$chk = 0
EndFunc ;==>xt

While 1
Sleep(200)
WEnd

HotKeySet("{F2}", "MSG")
HotKeySet("{F3}", "xt")

Func MSG()
$chk = 1
while 1
MsgBox(0, "TEST", "1")
MsgBox(0, "TEST", "2")
MsgBox(0, "TEST", "3")
MsgBox(0, "TEST", "4")
MsgBox(0, "TEST", "5")
$chk = 0
wend
EndFunc ;==>MSG

Func xt()
_main()
EndFunc ;==>xt

_main()
Func _main()
While 1
Sleep(200)
WEnd
EndFunc
Edited by DicatoroftheUSA
Link to comment
Share on other sites

@DicatoroftheUSA

Working 100%

many thanks. :)

EDIT: but is there anyway to do it with other commands? instead of msgbox?

EDIT2: its ok i will edit it :) thanks again.

Edited by Command3r

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

[font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...