Jump to content

Continue script after dialog closed


Recommended Posts

All,

I am writting a function that will pause the script and pop up a dialog box while the user makes a change to a remote computer. Once the user is finished configuring the remote computer, they should be able to click an unpause button to kill the dialog box and continue the script.

I have a dialog created with a select/case to exit when the button is pushed. I have used exitloop and exit, but neither work. Am i going about this the wrong way? Thanks.

Link to comment
Share on other sites

Am i going about this the wrong way?

We don't know what way you went. Post a short demo script and it should be easy to figure out your issue.

As a bonus, in my experience, there's about a 75% chance of you suddenly seeing the problem and fixing it on your own while working up the demo script. Extracting the problem from the context of the rest of your script and working on it in isolation is a wonderful teaching/learning tool.

:blink:

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

Very true and understood. Here it is. It completes Func1, then goes to the Pause function. The dialog appears, but when I press the completed button, the dialog does not disappear, but the script does move on to Func2. Thank you very much.

Func1()

Pause()

Func Pause()

GUICreate("FLASH", 250, 200 )

Opt("GUICoordMode", 1)

GUICtrlCreateLabel("Please configure and press Completed", 40, 10, 90)

$Completed = GUICtrlCreateButton("Completed", 20, 40, 90)

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $Completed

ExitLoop

EndSelect

WEnd

EndFunc

Func2()

Link to comment
Share on other sites

  • Moderators

byoda,

I think you need to look up GuiDelete in the help file.

And I agree with him! :blink:

M23

Func Pause()

    $hGUI = GUICreate("FLASH", 250, 200)

    Opt("GUICoordMode", 1)
    GUICtrlCreateLabel("Please configure and press Completed", 40, 10, 90)
    $Completed = GUICtrlCreateButton("Completed", 20, 40, 90)

    GUISetState()

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $Completed
                GUIDelete($hGUI)
                ExitLoop
        EndSelect
    WEnd
EndFunc   ;==>Pause

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

So do I :blink: Just got it. Thanks for both of your help.

Func1()

Pause()

Func Pause()

GUICreate("FLASH", 250, 200 )

Opt("GUICoordMode", 1)

GUICtrlCreateLabel("Please configure and press Completed", 40, 10, 90)

$Completed = GUICtrlCreateButton("Completed", 20, 40, 90)

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $Completed

GUIDelete()

ExitLoop

EndSelect

WEnd

EndFunc

Func2()

Link to comment
Share on other sites

So sleepydvdr called it for you already; you just needed GuiDelete() right before ExitLoop.

Another option is to use a standard MsgBox():

Global $f_Run = True

Func1()

Pause()

If $f_Run Then Func2()

Func Func1()
    ConsoleWrite("Debug:  Func1()" & @LF)
EndFunc   ;==>Func1

Func Func2()
    ConsoleWrite("Debug:  Func2()" & @LF)
EndFunc   ;==>Func2

Func Pause()
    If MsgBox(32 + 1, "FLASH", "Please configure application." & @CRLF & _
            "Press OK if successful, or CANCEL if can't comply...") = 1 Then
        ConsoleWrite("Debug:  Operator reports success" & @LF)
    Else
        $f_Run = False
        ConsoleWrite("Debug:  Operator reports can't comply" & @LF)
    EndIf
EndFunc   ;==>Pause

:blink:

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

if im not wrong . doesnt msgbox() also pause the script ?

just a stab in the dark

wouldnt

Func Pause()


GUICreate("FLASH", 250, 200 ) 

Opt("GUICoordMode", 1)

msgbox(1,"Please configure and Press 'Ok'".... (ect ect)

EndFunc

also work ?

sorry if i am wrong

//edit ........ DAMMIT SALTY

i had to go to the loo and you reply. ;) thunder killer *shakes fist* :blink:

Edited by Thornhunt

Budweiser + room = warm beerwarm beer + fridge = too long!warm beer + CO2 fire extinguisher = Perfect![quote]Protect the easly offended ... BAN EVERYTHING[/quote]^^ hmm works for me :D

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...