amcw Posted April 27, 2012 Share Posted April 27, 2012 Hi! I'm newbie in programming. I look forward to getting any help from you! I've searched in Help file and on the internet, but it didn't work out Is there any script that can pause the script and CONTINUE the current func not RESTART it?? here is the code: ;This is GUI. you can pass it $Form = GUICreate(@ScriptName, 350, 70,-1,-1) $Guide = GUICtrlCreateLabel("Choose your file:", 1, 2, 350, 21) $Input = GUICtrlCreateInput("", 1, 20, 299, 21) $browse = GUICtrlCreateButton("Browse", 300, 19, 50, 23) $start = GUICtrlCreateButton("Start!", 1, 42, 124, 25) $pause = GUICtrlCreateButton("Pause", 125, 42, 124, 25) $cancel = GUICtrlCreateButton("Cancel", 249, 42, 101, 25) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $start _start() case $pause _pause() EndSwitch WEnd func _start() send("a") send("b") send("c") endfunc I want when I click on Pause button, the script pauses, and when I click start again, it continue send "d" not "a". Thank you!!! Link to comment Share on other sites More sharing options...
Beege Posted April 27, 2012 Share Posted April 27, 2012 Hi amcw and welcome. Doing what you want to do is possible but not the way your thinking about doing it. Once your script enters the start function it does not stop until the function ends. Your main while loop is whats listening for the pause button so in order to do what you need, it would need to be in you main while loop, or your start function would need to send a char then return to main and check for pause the go back. Heres a small sample that will keep printing a-z, but listens for the pause and start at the same time. ;This is GUI. you can pass it $Form = GUICreate(@ScriptName, 350, 70, -1, -1) $Guide = GUICtrlCreateLabel("Choose your file:", 1, 2, 350, 21) $Input = GUICtrlCreateInput("", 1, 20, 299, 21) $browse = GUICtrlCreateButton("Browse", 300, 19, 50, 23) $start = GUICtrlCreateButton("Start!", 1, 42, 124, 25) $pause = GUICtrlCreateButton("Pause", 125, 42, 124, 25) $cancel = GUICtrlCreateButton("Cancel", 249, 42, 101, 25) GUISetState() $bStarted = False $chr = 97 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3 ;$GUI_EVENT_CLOSE Exit Case $start $bStarted = True Case $pause $bStarted = False EndSwitch If $bStarted Then ;~ Send(Chr($chr)) ConsoleWrite(Chr($chr) & @LF); use consolewrite for testing purposes. $chr += 1 If $chr = 122 Then $chr = 97 EndIf WEnd Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
amcw Posted April 27, 2012 Author Share Posted April 27, 2012 Hi amcw and welcome. Doing what you want to do is possible but not the way your thinking about doing it. Once your script enters the start function it does not stop until the function ends. Your main while loop is whats listening for the pause button so in order to do what you need, it would need to be in you main while loop, or your start function would need to send a char then return to main and check for pause the go back. Heres a small sample that will keep printing a-z, but listens for the pause and start at the same time. ;This is GUI. you can pass it $Form = GUICreate(@ScriptName, 350, 70, -1, -1) $Guide = GUICtrlCreateLabel("Choose your file:", 1, 2, 350, 21) $Input = GUICtrlCreateInput("", 1, 20, 299, 21) $browse = GUICtrlCreateButton("Browse", 300, 19, 50, 23) $start = GUICtrlCreateButton("Start!", 1, 42, 124, 25) $pause = GUICtrlCreateButton("Pause", 125, 42, 124, 25) $cancel = GUICtrlCreateButton("Cancel", 249, 42, 101, 25) GUISetState() $bStarted = False $chr = 97 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3 ;$GUI_EVENT_CLOSE Exit Case $start $bStarted = True Case $pause $bStarted = False EndSwitch If $bStarted Then ;~ Send(Chr($chr)) ConsoleWrite(Chr($chr) & @LF); use consolewrite for testing purposes. $chr += 1 If $chr = 122 Then $chr = 97 EndIf WEnd Thank you very much!! This is what i'm looking for! Link to comment Share on other sites More sharing options...
amcw Posted April 27, 2012 Author Share Posted April 27, 2012 (edited) I've got new problem Still the ancient topic, but not sending each character in the alphabet but doing some tasks ;This is GUI. you can pass it $Form = GUICreate(@ScriptName, 350, 70, -1, -1) $Guide = GUICtrlCreateLabel("Choose your file:", 1, 2, 350, 21) $Input = GUICtrlCreateInput("", 1, 20, 299, 21) $browse = GUICtrlCreateButton("Browse", 300, 19, 50, 23) $start = GUICtrlCreateButton("Start!", 1, 42, 124, 25) $pause = GUICtrlCreateButton("Pause", 125, 42, 124, 25) $cancel = GUICtrlCreateButton("Cancel", 249, 42, 101, 25) GUISetState(SW_SHOW) $bStarted = False While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3 ;$GUI_EVENT_CLOSE Exit Case $start $bStarted = True Case $pause $bStarted = False EndSwitch If $bStarted Then mousemove(500,500) sleep(1000) send("a") sleep(1000) msgbox(0,"abc","xyz") EndIf Wend (mousemove, send, msgbox functions are just examples) Edited April 27, 2012 by amcw Link to comment Share on other sites More sharing options...
Beege Posted April 28, 2012 Share Posted April 28, 2012 (edited) Msgbox() is a function that will pause your script until it is closed. Sleep() is also clearly a function that will pause your script until the specified time runs out. Anytime your script is paused, it will not be listening for button presses. Edited April 28, 2012 by Beege Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now