Jump to content
Sign in to follow this  
Command3r

Stop Func problem

Recommended Posts

Command3r

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]

Share this post


Link to post
Share on other sites
DicatoroftheUSA

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
  • Like 1

Share this post


Link to post
Share on other sites
Command3r

@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]

Share this post


Link to post
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
Sign in to follow this  

  • Similar Content

    • chacoya121
      By chacoya121
      can someone plz explain how WinAPI work and some example script plz
    • krasnoshtan
      By krasnoshtan
      Hello forum users!
      At some point I had a need to restart my script. Is it possible to do this with autoit or do I need to connect additional scripts like .cmd or .bat?
      For example: i have only script.au3 and it's running. Wich code shoud i use to exit from the script and start it again?
    • watchoverme
      By watchoverme
      hi all, how can i move mouse to the place where pixel changes
       
      While Sleep (3000)
      $pix = PixelChecksum(0,0,55,55)
      If IsArray($pix) = True Then
      MouseMove($pix [0],$pix[1])
      EndIf
      WEnd
    • Rskm
      By Rskm
      Hi, I wrote the below code to learn user defined functions.. jam is the function which calculates summation and division of two numbers $a, $b.. I expect the $sum and $div receives the results $r and $s respectively from the function... but the msbox in the main program doesn't display results properly, while the one inside func shows it correclty. how do I pull the values in $r and $s to $sum and $div respectively.. thanks for all the help on this forum
       
      global $a,$b,$sum,$div
      $a=1
      $b=2 jam($a,$b,$sum,$div) msgbox(0,"results",$sum&" , "&$div)     func jam($p,$q,$r,$s )
       $r=$p+$q  $s = $p/$q msgbox(0,"results",$r&" , "&$s) EndFunc  
    • Amixg
      By Amixg
      Hi! I have another problem with AutoIT.  You see, I'm still the one who's just starting out with this great programming language. I have a problem with AutoIT, it seems not to recognize the "StringReplace" function even when it is by default. The code was made half in KODA and half of my own. It is a software programmed for the Italian language (I am Italian) and translate the SMS language into Italian correct. Would you help me? Thanks in advance.
       
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $hull = "hello" StringReplace($hull, "hello", "hellx") $Form1 = GUICreate("Linguaggio SMS A Italiano", 507, 498, 192, 124) $Edit1 = GUICtrlCreateEdit("", 24, 40, 465, 177) GUICtrlSetData(-1, "") $Label1 = GUICtrlCreateLabel("Inserisci qui il testo che non riesci a capire:", 24, 8, 205, 17) $Label2 = GUICtrlCreateLabel("Ecco il testo tradotto(non toccare questo campo):", 27, 237, 237, 17) $Edit2 = GUICtrlCreateEdit("", 24, 264, 465, 137) GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("Traduci", 104, 424, 249, 49) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 StringReplace(GUICtrlGetData($Label1), "qlc", "qualcuno") StringReplace(GUICtrlGetData($Label1), "qls", "qualcosa") StringReplace(GUICtrlGetData($Label1), "ke", "che") StringReplace(GUICtrlGetData($Label1), "x", "per") StringReplace(GUICtrlGetData($Label1), "pls", "per favore") StringReplace(GUICtrlGetData($Label1), "tu6", "tu sei") StringReplace(GUICtrlGetData($Label1), "zzz", "mi fai dormire") StringReplace(GUICtrlGetData($Label1), "hagn", "Buonanotte") StringReplace(GUICtrlGetData($Label1), "tvtb", "Ti voglio tanto bene") StringReplace(GUICtrlGetData($Label1), "tat", "Ti amo tanto") StringReplace(GUICtrlGetData($Label1), "lafs", "Amore a prima vista") StringReplace(GUICtrlGetData($Label1), "fli?", "Flirtiamo?") StringReplace(GUICtrlGetData($Label1), "msidt", "Mi sono innamorato di te") StringReplace(GUICtrlGetData($Label1), "ba", "Bacio") StringReplace(GUICtrlGetData($Label1), "midi", "Mi dispiace.") StringReplace(GUICtrlGetData($Label1), "ntm", "Non ti merito") StringReplace(GUICtrlGetData($Label1), "tdp", "Togliti dai piedi.") StringReplace(GUICtrlGetData($Label1), "amò", "Amore") StringReplace(GUICtrlGetData($Label1), "ap", "A presto!") StringReplace(GUICtrlGetData($Label1), "cmq", "comunque") StringReplace(GUICtrlGetData($Label1), "cvd", "Ci vediamo dopo") StringReplace(GUICtrlGetData($Label1), "Tvb", "Ti voglio bene") StringReplace(GUICtrlGetData($Label1), "nn", "non") StringReplace(GUICtrlGetData($Label1), "risp", "rispondimi") StringReplace(GUICtrlGetData($Label1), "cel", "cellulare") StringReplace(GUICtrlGetData($Label1), "dom", "qualcosa") StringReplace(GUICtrlGetData($Label1), "nm", "numero") StringReplace(GUICtrlGetData($Label1), "fv", "favore") StringReplace(GUICtrlGetData($Label1), "-male", "meno male") StringReplace(GUICtrlGetData($Label1), "disc", "discoteca") StringReplace(GUICtrlGetData($Label1), "se#", "settimana") StringReplace(GUICtrlGetData($Label1), "+ o -", "più o meno") StringReplace(GUICtrlGetData($Label1), "ts", "torno subito") StringReplace(GUICtrlGetData($Label1), "tvtbcoa", "Ti voglio tanto bene come amica") EndSwitch WEnd  
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.