Sign in to follow this  
Followers 0
232showtime

hotkey Stop script

13 posts in this topic

#1 ·  Posted (edited)

good day, can someone help me how to stop and start loop while not exiting the program?

for example

HotKeySet("{`}", "StopScript")

While

Sleep(10)

wend

Func StopScript()

StopScript ;????
 
Endfunc

I tried to use Global Pause and its not helping coz if It pauses in line 22 it will start again in line 22 inside while loop..

what i want stop the script on line 22, and start  again on line 1 inside the while loop, without exiting the program... i really dont know which command to use. thanks in advance.

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites



There's only 7 lines in your snippet, 13 if you count the blanks, where's line 22 and what exactly is your script doing? Post your script, because there's not enough information in what you posted to give you any kind of answer.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Look at

ContinueLoop

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Does Exitloop function helps you?

Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

There's only 7 lines in your snippet, 13 if you count the blanks, where's line 22 and what exactly is your script doing? Post your script, because there's not enough information in what you posted to give you any kind of answer.

its only an example, here

While 1
    $x4 = ControlGetText("DOCumentation management system", "", "[CLASS:TEdit; INSTANCE:1]")
    If _IsPressed('70') = 1 Then
        ControlClick("DOCumentation management system", "", "[CLASS:TBitBtn;INSTANCE:3]");F1 Show Doc
    EndIf
    Sleep(10)
    If _IsPressed('71') = 1 Then ControlClick("DOCumentation management system", "", "[CLASS:TBitBtn;INSTANCE:2]");F2 Show Comments
    Sleep(10)
    If _IsPressed('74') = 1 Then
        WinActivate("DOCumentation management system")
        ControlClick("DOCumentation management system", "", "[CLASS:TEdit;INSTANCE:1]")
        Send("^a")
        Send("^v");F5 Search
    EndIf

    If _IsPressed('02') = 1 Then ControlClick("New Revision", "", "[CLASS:TBitBtn;INSTANCE:2]");Save Revision
    Sleep(10)
    If _IsPressed('72') = 1 Then ControlClick("DOCumentation management system", "", "[CLASS:TButton;INSTANCE:2]");F3 Ref Doc Show Revision
    Sleep(10)
    If _IsPressed('73') = 1 Then ControlClick("DOCumentation management system", "", "[CLASS:TButton;INSTANCE:1]");F4 Ref Doc Show Doc
    Sleep(10)

    If WinExists("[CLASS:TFrmStatistic]") Then
        WinClose("[CLASS:TFrmStatistic]")
    EndIf
    Sleep(10)
    If WinExists("[CLASS:TFrmSpecProject]") Then
        ControlClick("New Revision", "", "[CLASS:TDBEdit;INSTANCE:1]")
        ControlSetText("[CLASS:TFrmSpecProject]", "", "[CLASS:TDBEdit; INSTANCE:1]", $x4)
        WinWaitClose("[CLASS:TFrmSpecProject]")
    EndIf
    Sleep(10)


    If WinExists("[CLASS:TFrmModuleImport]") Then
        WinClose("[CLASS:TFrmModuleImport]")
    EndIf
    Sleep(10)
    If WinExists("[CLASS:bosa_sdm_XL9]") Then
        WinClose("[CLASS:bosa_sdm_XL9]")
    EndIf
    Sleep(10)

WEnd

 

 

Look at

ContinueLoop

Ill try this...

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

what i want stop the script on line 22, and start  again on line 1 inside the while loop, without exiting the program

 

Does Exitloop function helps you?

 

Doesn't want to exit ;)

Edited by MikahS
1 person likes this

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

Does Exitloop function helps you?

I will try this also again, I include exitloop in while loop and it exit the whole program...


ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

just wanted to understand a bit more.. why do you want to pause it and start over your program? if you want to pause, how long you want to pause? do you have any time specific time to start over? Bcoz Autoit does not support GOTO line number function. you have to create the logic for that action.. 

Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

If _IsPressed("C0") = 1 Then ContinueLoop

or this might work as well

If _IsPressed("C0") Then ContinueLoop

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

just wanted to understand a bit more.. why do you want to pause it and start over your program? if you want to pause, how long you want to pause? do you have any time specific time to start over? Bcoz Autoit does not support GOTO line number function. you have to create the logic for that action.. 

because i need it here see below

this is the fastest idea i ever had dont have much time to analyze...

If _IsPressed("C0") = 1 Then ContinueLoop

or this might work as well

If _IsPressed("C0") Then ContinueLoop

@mika and @syed23 sorry the 1st script i posted is different i was on a rush yesterday, i want to use the stop/start script with this 2nd script because i have a long script same like this

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1_1 = GUICreate("Form1", 245, 260, 192, 124, Default, $WS_EX_TOPMOST)
$1 = GUICtrlCreateButton("-", 32, 88, 75, 25)
$2 = GUICtrlCreateButton("A", 32, 128, 75, 25)
$3 = GUICtrlCreateButton("B", 32, 168, 75, 25)
$4 = GUICtrlCreateButton("C", 32, 208, 75, 25)
$5 = GUICtrlCreateButton("0", 136, 88, 75, 25)
$6 = GUICtrlCreateButton("1", 136, 128, 75, 25)
$7 = GUICtrlCreateButton("2", 136, 168, 75, 25)
$8 = GUICtrlCreateButton("3", 136, 208, 75, 25)
$xT = GUICtrlCreateInput("", 120, 56, 81, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Opt("SendKeyDelay", 5)
Opt("SendKeyDownDelay", 5)

While 1


    $x1 = GUICtrlRead($xT)
    $x2 = GUICtrlRead($xA)
    $x3 = ControlGetText("DOCumentation management system", "", "[CLASS:TEdit; INSTANCE:1]")
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $1
            ControlSend("Reference Document Revision", "", "[CLASS:TwwDBEdit;INSTANCE:4]", "-"); Click & Send Revision 1
            Sleep(400)
            ControlClick("Reference Document Revision", "", "[CLASS:TBtnWinControl;INSTANCE:2]"); Click Date
            Sleep(400)
            WinActivate("[CLASS:TFrmRevSpecifica]"); activate add doc. revision window
            Sleep(400)
            ControlClick("Reference Document Revision", "", "[CLASS:TBtnWinControl;INSTANCE:1]"); click issue status
            Sleep(400)
            ControlSend("Reference Document Revision", "", "[CLASS:TwwDBLookupCombo;INSTANCE:1]", "5") ; select 1 issue status
            Sleep(400)
            Send("{DOWN}")
            Sleep(400)
            Send("{ENTER}")
            Sleep(400)
            ControlClick("Reference Document Revision", "", "[CLASS:TBitBtn;INSTANCE:3]"); Click load Rev.
            Sleep(400)
            ControlSend("Open", "", "[CLASS:Edit;INSTANCE:1]", $x3) ; Load PDF
            Sleep(400)
            ControlSend("Open", "", "", "{DOWN}")
            Sleep(400)
            ControlClick("Open", "", "[CLASS:Button;INSTANCE:2]")
            Sleep(400)
            ControlSetText("Reference Document Revision", "", "[CLASS:TwwDBEdit;INSTANCE:2]", $x2 & $x1) ; send Transmittal
            Sleep(400)
            ControlClick("Reference Document Revision", "", "[CLASS:TBitBtn;INSTANCE:2]"); Click Show rev
            WinWaitClose("[CLASS:TFrmRevSpecific]")
            ProcessClose("Acrobat.exe")
    EndSwitch

WEnd
Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites

As per my knowledge While-Wend loop is never ending loop until you exit the program. so what i will suggest you is to give a try by adding a case with Stop function like pause the script and put a another case to use continueloop to continue with While loop. this may help you to acheive what you are looking for.


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

ok i will try... thanks

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites

probably can not be the best example what you are looking for but may give some help....

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1_1 = GUICreate("Form1", 245, 260, 192, 124, Default, $WS_EX_TOPMOST)
$1 = GUICtrlCreateButton("-", 32, 88, 75, 25)
$2 = GUICtrlCreateButton("A", 32, 128, 75, 25)
$3 = GUICtrlCreateButton("B", 32, 168, 75, 25)
$4 = GUICtrlCreateButton("C", 32, 208, 75, 25)
$5 = GUICtrlCreateButton("0", 136, 88, 75, 25)
$6 = GUICtrlCreateButton("1", 136, 128, 75, 25)
$7 = GUICtrlCreateButton("2", 136, 168, 75, 25)
$8 = GUICtrlCreateButton("3", 136, 208, 75, 25)
$xT = GUICtrlCreateInput("", 120, 56, 81, 21)
HotKeySet("{F1}","about")

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Opt("SendKeyDelay", 5)
Opt("SendKeyDownDelay", 5)

While 1



    $nMsg = GUIGetMsg()

    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $1
            MsgBox(0,"","Inside Loop")

    EndSwitch

WEnd


Func about()

    MsgBox(0,"Func","I AM Here") ; you can add your pause script here
EndFunc

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/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  
Followers 0