Jump to content

Stop and Start


 Share

Recommended Posts

How to do that program was halted and only resumed it after clicking

Because I just made ​​a script that performs the functions then shows me the gui and then performs funkjce. And I want to only when shown in the GUI press the Next button it has wykonwyać further.

Func startnot()
MsgBox(0, "Run", "Notepad")
Run("notepad.exe")
MsgBox(0, "Run", "Open")
$iWidth = 300
$iHeight = 50
Local $hWnd = GUICreate("Notepad", $iWidth, $iHeight+100)
GuiSetOnEvent($GUI_EVENT_CLOSE,"exi")
      $Inputcapkod= GUICtrlCreateInput("", $iWidth-270, $iHeight+10, 121, 21)
            $Buttcaplog = GUICtrlCreateButton("Paste", $iWidth-270, $iHeight+40, 90, 30, $WS_GROUP)
            GuiCtrlSetOnEvent(-1,"pass")
GUISetState(@SW_SHOW)
MsgBox(0, "STOP", "STOPFunc")
;Here the function stop
MsgBox(0, "resume function", "resume function")
MsgBox(4, "NotePAD", "Used")
;the rest of the code that is to be resumed
EndFunc
Func exi()
Exit()
EndFunc

Func paste()
Run ("calc")
;function start here
MsgBox(0, "START", "START-FUNC")
EndFunc
Edited by metis
Link to comment
Share on other sites

How to do that program was halted and only resumed it after clicking

Because I just made ​​a script that performs the functions then shows me the gui and then performs funkjce. And I want to only when shown in the GUI press the Next button it has wykonwyać further.

A few more passes through Filipino-to-Chinese-to-Klingon-to-English in Google translate could make that question even less clear, if that was what you were shooting for...

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Nr.1 translator PL>EN

I don't know English well - sorry

I mean it that how he will show for me gui it is supposed to stop more distant functions and only when in it shown gui I will press it farther for me is resuming the program.

Nr.2 translator(google) PL>EN

I do not know English well - sorry

I mean that as my gui display it has more features and stay just as it appears, press the gui that I continue to renew the program.

Text orginalny PL

Nie umiem dobrze angielskiego - sorry

chodzi mi o to że jak wyświetli mi gui to ma zatrzymać dalsze funkcje i dopiero jak w tym wyświetlonym gui nacisnę dalej to mi wznawia program.

CODE :
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
MsgBox(0, "Run", "Notepad")
Run("notepad.exe")

startnot()

MsgBox(0, "resume function", "resume function")
MsgBox(4, "NotePAD", "Used")
;code ......

Func startnot()
MsgBox(0, "Runs", "OpenGUI")
$iWidth = 300
$iHeight = 50
Local $hWnd = GUICreate("Notepad", $iWidth, $iHeight+100)
GuiSetOnEvent($GUI_EVENT_CLOSE,"exi")
      $Inputcapkod= GUICtrlCreateInput("", $iWidth-270, $iHeight+10, 121, 21)
            $Buttcaplog = GUICtrlCreateButton("Paste", $iWidth-270, $iHeight+40, 90, 30, $WS_GROUP)
            GuiCtrlSetOnEvent(-1,"pass")
GUISetState(@SW_SHOW)
;stop
EndFunc
Func exi()
Exit()
EndFunc

Func pass()
    MsgBox(0, "Resmue", "Resume")
    ;start func
    EndFunc
Link to comment
Share on other sites

I guess you want something like this:

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode",1) ;You need this to use "GUISetOnEvent()" and "GUICtrlSetOnEvent()"

MsgBox(0, "Run", "Notepad")
Run("notepad.exe")

MsgBox(0, "Runs", "OpenGUI")

Global $iWidth = 300, $iHeight = 50, $CtrlId_Input

GUICreate("Notepad", $iWidth, $iHeight + 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$CtrlId_Input = GUICtrlCreateInput("", $iWidth - 270, $iHeight + 10, 121, 21)
GUICtrlCreateButton("Paste", $iWidth - 270, $iHeight + 40, 90, 30, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_Paste")
GUISetState(@SW_SHOW)

While 1
    Sleep(10) ;Here the script just waits for events.
WEnd


Func _Exit()
    Exit
EndFunc

Func _Paste()
    Local $OldText = ControlGetText("[CLASS:Notepad]", "", "Edit1") ;get the text currently in notepad, unless you want to replace the current content.
    Local $NewText = GUICtrlRead($CtrlId_Input) ;Get the text in the input control.
    ControlSetText("[CLASS:Notepad]", "", "Edit1",$OldText & $NewText) ;set the combined text into notepad.
    GUICtrlSetData($CtrlId_Input,"") ;clear the input control for new data.
EndFunc
Link to comment
Share on other sites

PL>EN

That is not what I mean. I mean that he stop (does not perform other functions) to the time not to press the key in the gui then it has resumed dlaszy string functions.

PL>EN 2

Not I mean it. I mean so that he gives alloy (isn't carrying more distant functions out) up to the time I won't press a key in gui then is supposed to resume dlaszy sequence of the function.

Polish :

Nie o to mi chodzi. Chodzi mi żeby dał stop (nie wykonuje dalszych funkcji) do czasu gdy nie nacisnę klawiszu w gui wtedy ma wznawiać dlaszy ciąg funkcji.

Link to comment
Share on other sites

Another guess, as the translations clearly don't help a lot:

Do you want a password to run a part of the script?

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode",1) ;You need this to use "GUISetOnEvent()" and "GUICtrlSetOnEvent()"

MsgBox(0, "Run", "Notepad")
Run("notepad.exe")

MsgBox(0, "Runs", "OpenGUI")

Global $iWidth = 300, $iHeight = 50, $CtrlId_Input, $sPassword = "UltraSecretPass"

GUICreate("Notepad", $iWidth, $iHeight + 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$CtrlId_Input = GUICtrlCreateInput("", $iWidth - 270, $iHeight + 10, 121, 21,$ES_PASSWORD)
GUICtrlCreateButton("Paste", $iWidth - 270, $iHeight + 40, 90, 30, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_Pass")
GUISetState(@SW_SHOW)

While 1
    Sleep(10) ;Here the script just waits for events.
WEnd

Func _Pass()
    ConsoleWrite(GUICtrlRead($CtrlId_Input) & @CRLF)
    If StringCompare(GUICtrlRead($CtrlId_Input), $sPassword,1) <> 0 Then
        MsgBox(0,"Password incorrect", "Closing script" )
        Exit
    EndIf
    MsgBox(0,"Password correct", "Resuming script")
    ;Rest of script
EndFunc

Func _Exit()
    Exit
EndFunc
Link to comment
Share on other sites

EN>PL(google tr)

Almost, I just do not make me what to GUJ (displays a message and should not

I can not give it because I have a func positioned so that the code does not allow me to do this

EN>PL

Almost well he isn't only doing it for me what after guj (he is showing the announcement and he should not)

I cannot give it in func since I have the code this way placed that he doesn't let me it

PL

Prawie dobrze tylko nie robi mi to co po guj (wyświetla komunikat a nie powinien)

nie mogę dać tego w func ponieważ mam tak ustawiony kod że nie pozwala mi na to

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode",1) ;You need this to use "GUISetOnEvent()" and "GUICtrlSetOnEvent()"

MsgBox(0, "Run", "Notepad")
Run("notepad.exe")

MsgBox(0, "Runs", "OpenGUI")

Global $iWidth = 300, $iHeight = 50, $CtrlId_Input, $sPassword = "UltraSecretPass"

GUICreate("Notepad", $iWidth, $iHeight + 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$CtrlId_Input = GUICtrlCreateInput("", $iWidth - 270, $iHeight + 10, 121, 21,$ES_PASSWORD)
GUICtrlCreateButton("Paste", $iWidth - 270, $iHeight + 40, 90, 30, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_Pass")
GUISetState(@SW_SHOW)

MsgBox(0, "script-ok", "ok.good password.continue code")
....;continue script
While 1
    Sleep(10) ;Here the script just waits for events.
WEnd

Func _Pass()
    ConsoleWrite(GUICtrlRead($CtrlId_Input) & @CRLF)
    If StringCompare(GUICtrlRead($CtrlId_Input), $sPassword,1) <> 0 Then
        MsgBox(0,"Password incorrect", "Closing script" )
        Exit
    EndIf
    MsgBox(0,"Password correct", "Resuming script")
    ;Rest of script
EndFunc

Func _Exit()
    Exit
EndFunc
Edited by metis
Link to comment
Share on other sites

I cannot give it in func since I have the code this way placed that he doesn't let me it

(PL nie mogę dać tego w func ponieważ mam tak ustawiony kod że nie pozwala mi na to)

You can always adjust code to work inside a function. Usually it's just a simple copy/paste.

This way you can leave the code out of a function. The messagebox can just be commented out.

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode",1) ;You need this to use "GUISetOnEvent()" and "GUICtrlSetOnEvent()"

MsgBox(0, "Run", "Notepad")
Run("notepad.exe")

MsgBox(0, "Runs", "OpenGUI")

Global $iWidth = 300, $iHeight = 50, $CtrlId_Input, $fPassword = False, $sPassword = "UltraSecretPass"

GUICreate("Notepad", $iWidth, $iHeight + 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$CtrlId_Input = GUICtrlCreateInput("", $iWidth - 270, $iHeight + 10, 121, 21,$ES_PASSWORD)
GUICtrlCreateButton("Paste", $iWidth - 270, $iHeight + 40, 90, 30, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_Pass")
GUISetState(@SW_SHOW)

While $fPassword = False ;wait untill a password is entered.
    Sleep(10)
WEnd

MsgBox(0, "script-ok", "ok.good password.continue code")
;continue script


Func _Pass()
    If StringCompare(GUICtrlRead($CtrlId_Input), $sPassword,1) <> 0 Then
        GUICtrlSetData($CtrlId_Input,"")
        MsgBox(0,"Invalid Password","Just remove line 32 if you don't like the message")
    Else
        $fPassword = True ;set the flag to True, making the loop at line 21 exit and continues the script at line 24.
    EndIf
EndFunc

Func _Exit()
    Exit
EndFunc
Link to comment
Share on other sites

And when I have done loops, it will not be a problem with the operation. Because now my bot is not

And when I already have done loops it won't be of problem with action. Because now the lined boot for me doesn't walk

A gdy mam już zrobioną pętle to nie będzie problemu z działaniem. Bo teraz bot mi nie chodzi

code :

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
Msgbox(0,"TEST","before")
test()
Msgbox(0,"TEST","after")
;... continue code

Func test()
Opt("GUIOnEventMode",1)
Local $iWidth = 400
Local $iHeight = 300
Local $hWnd = GUICreate("Note", $iWidth, $iHeight+100)
GuiSetOnEvent($GUI_EVENT_CLOSE,"ex")
      $Inputcapkod= GUICtrlCreateInput("", $iWidth-270, $iHeight+10, 121, 21)
      $CtrlId_Input = GUICtrlCreateInput("", $iWidth - 270, $iHeight + 30, 121, 21)
            $Buttcaplog = GUICtrlCreateButton("Paste", $iWidth-270, $iHeight+40, 90, 30, $WS_GROUP)
            GuiCtrlSetOnEvent(-1,"_Paste")

GUISetState(@SW_SHOW)


While $fPassword = False ;wait untill a password is entered.
    Sleep(10)
WEnd
EndFunc

        Func _Paste()
            
              If StringCompare(GUICtrlRead($CtrlId_Input), $sPassword,1) <> 0 Then
        GUICtrlSetData($CtrlId_Input,"")
        MsgBox(0,"Invalid Password","Just remove line 32 if you don't like the message")
    Else
        $fPassword = True ;set the flag to True, making the loop at line 21 exit and continues the script at line 24.
                 if GUICtrlRead($Inputcapkod) = "" Then
    MsgBox(0, "Error", "error")
EndIf
Msgbox(0,"OK","HIDE")
         GUISetState(@SW_HIDE, $hWnd)
    EndIf
    

EndFunc
Link to comment
Share on other sites

ok-Done

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>


Msgbox(0,"TEST","before")
$fPassword = False
test()
Msgbox(0,"TEST","after1")
$fPassword = False
test()
Msgbox(0,"TEST","after2")
$fPassword = False
test()
Msgbox(0,"TEST","after3")
$fPassword = False
test()
Msgbox(0,"TEST","after4")
Msgbox(0,"TEST","after5")
Msgbox(0,"TEST","after6")
;... continue code

Func test()
Global $iWidth = 300, $iHeight = 50, $CtrlId_Input, $fPassword = False, $sPassword = "UltraSecretPass"
Opt("GUIOnEventMode",1)

$hWnd = GUICreate("Note", $iWidth, $iHeight+100)
GuiSetOnEvent($GUI_EVENT_CLOSE,"ex")
      $Inputcapkod = GUICtrlCreateInput("", $iWidth-270, $iHeight+10, 121, 21)
      $CtrlId_Input = GUICtrlCreateInput("", $iWidth - 270, $iHeight + 80, 121, 21)
            $Buttcaplog = GUICtrlCreateButton("Paste", $iWidth-270, $iHeight+40, 90, 30, $WS_GROUP)
            GuiCtrlSetOnEvent(-1,"_Paste")

GUISetState(@SW_SHOW)


While $fPassword = False ;wait untill a password is entered.
    Sleep(10)
WEnd
EndFunc

Func _Paste()
    If StringCompare(GUICtrlRead($CtrlId_Input), $sPassword,1) <> 0 Then
        GUICtrlSetData($CtrlId_Input,"")
        MsgBox(0,"Invalid Password","Just remove line 32 if you don't like the message")
    Else
        $fPassword = True ;set the flag to True, making the loop at line 21 exit and continues the script at line 24.
            GUIDelete()
    EndIf

EndFunc
Link to comment
Share on other sites

Hi,

i hope this is what you want:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

startnot()

Func startnot()
    $bOldOnEvent = Opt("GUIOnEventMode", 0) ;change the Msg-Loop
    MsgBox(0, "Run", "Notepad")
    Run("notepad.exe")
    MsgBox(0, "Run", "Open")
    $iWidth = 300
    $iHeight = 50
    Local $hWnd = GUICreate("Notepad", $iWidth, $iHeight + 100)
    $Inputcapkod = GUICtrlCreateInput("", $iWidth - 270, $iHeight + 10, 121, 21)
    $Buttcaplog = GUICtrlCreateButton("&Paste", $iWidth - 270, $iHeight + 40, 90, 30, $WS_GROUP)
    GUICtrlSetState($Buttcaplog,$GUI_DISABLE)
    GUICtrlSetOnEvent(-1, "paste")
    GUISetState(@SW_SHOW)
    While 1
        if BitAND(GUICtrlGetState($Buttcaplog),$GUI_DISABLE) Then   ;only when Paste is disabled
            if GuiCtrlRead($Inputcapkod) == "OK" Then _ ;check for the Passwort
            GUICtrlSetState($Buttcaplog,$GUI_ENABLE)    ;only when it is the right Passwort
        EndIf
        Switch GuiGetMsg()
            case $GUI_EVENT_CLOSE
                Exit    ;maybe Return is the better method
            Case $Buttcaplog
                    Paste()
                    GUIDelete($hWnd)
                    ExitLoop
        EndSwitch
    Wend
    MsgBox(4, "NotePAD", "Used")
    ;the rest of the code that is to be resumed
    Opt("GUIOnEventMode", $bOldOnEvent) ;Restore old Modus (maybe GuiOnEvent-Mode
EndFunc   ;==>startnot
Func exi()
    Exit
EndFunc   ;==>exi

Func paste()
    Run("calc")
    ;function start here
    MsgBox(0, "START", "START-FUNC")
EndFunc   ;==>paste

mfg autoBert

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...