Jump to content



Photo

Stop Func problem

Func function stop how to help

  • Please log in to reply
2 replies to this topic

#1 Command3r

Command3r

    Wayfarer

  • Active Members
  • Pip
  • 76 posts

Posted 12 July 2012 - 10:00 PM

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:

AutoIt         
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, 12 July 2012 - 10:20 PM.

Sorry for my bad english, i'll improve it :)

-------------------------------------------------------

My advice to you: Search before posting.








#2 DicatoroftheUSA

DicatoroftheUSA

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 473 posts

Posted 12 July 2012 - 10:22 PM

AutoIt         
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


AutoIt         
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, 12 July 2012 - 10:30 PM.

  • Command3r likes this

#3 Command3r

Command3r

    Wayfarer

  • Active Members
  • Pip
  • 76 posts

Posted 12 July 2012 - 10:29 PM

@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, 12 July 2012 - 10:31 PM.

Sorry for my bad english, i'll improve it :)

-------------------------------------------------------

My advice to you: Search before posting.






Also tagged with one or more of these keywords: Func, function, stop, how, to, help

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users