 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
OrelseIamfired
Joined: 13 Mar 2006 Posts: 60 Location: Ottawa, Canada
|
Posted: Fri Jun 29, 2007 8:16 pm Post subject: GUI and program flow |
|
|
Hi,
I want to know how to make a program flow such that, after a GUI, Destroy is done, the program can continue processing.
For the sake of discussion, let us say that I have three parts of the script, Part1, Part2 and Part3. Part1 runs without an interface. In Part2, a GUI is created to interact with the user. The GUI has three buttons with a Go-sub for each. Go-subs normally end with a Return or ExitApp statement. After Part2 completes, the GUI is destroyed (each Go-sub has a destroy statement), and the script continues into Part3.
To get to Part3, the only thing that I can think of is to use several Goto, Part3 statements, but it disturbs me to ignore using a Return statement when one is required. Is there some other way to do this?
| Code: | Part1:
/*
Do some stuff here that does not require user interaction.
*/
Sleep, 1000
Part2:
; Create a GUI with three buttons.
Gui, Add, Text, x16 y17 w380 h20, Blah blah blah
Gui, Add, Button, x16 y47 w110 h30 gCreateCert, Create
Gui, Add, Button, x156 y47 w110 h30 gCopyCert, Copy
Gui, Add, Button, x296 y47 w100 h30 gCancel, Do later
Gui, Show, x386 y319 h97 w417, My GUI title
Return
GuiClose:
Cancel:
Gui, Destroy
; Goto, Part3
CreateCert:
Gui, Destroy
; Create heaven and earth.
; Goto, Part3
CopyCert:
Gui, Destroy
; Do some copying
; Goto, Part3
Part3:
; Continue with other business.
; Rest on the seventh day if necessary.
ExitApp |
/ Louis |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Fri Jun 29, 2007 9:46 pm Post subject: |
|
|
| Code: |
Part1:
/*
Do some stuff here that does not require user interaction.
*/
Sleep, 1000
Part2:
; Create a GUI with three buttons.
Gui, Add, Text, x16 y17 w380 h20, Blah blah blah
Gui, Add, Button, x16 y47 w110 h30 gCreateCert, Create
Gui, Add, Button, x156 y47 w110 h30 gCopyCert, Copy
Gui, Add, Button, x296 y47 w100 h30 gCancel, Do later
Gui, Show, x386 y319 h97 w417, My GUI title
Return
GuiClose:
Cancel:
Gui, Destroy
Gosub, Part3
Return
CreateCert:
Gui, Destroy
Gosub, Part3
Return
CopyCert:
Gui, Destroy
Gosub, Part3
Return
Part3:
; Continue with other business.
; Rest on the seventh day if necessary.
ExitApp
|
Either Got or Gosub is fine, since the ExitApp at the end of Part three kills all anyway. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
nick
Joined: 24 Aug 2005 Posts: 345 Location: Berlin / Germany
|
Posted: Sat Jun 30, 2007 7:56 am Post subject: |
|
|
Another approach:
| Code: | Part1:
/*
Do some stuff here that does not require user interaction.
*/
Sleep, 1000
Part2:
; Create a GUI with three buttons.
Gui, Add, Text, x16 y17 w380 h20, Blah blah blah
Gui, Add, Button, x16 y47 w110 h30 gCreateCert, Create
Gui, Add, Button, x156 y47 w110 h30 gCopyCert, Copy
Gui, Add, Button, x296 y47 w100 h30 gCancel, Do later
Gui, Show, x386 y319 h97 w417, My GUI title
Gui, +LastFound
WinWaitClose
Part3:
; Continue with other business.
; Rest on the seventh day if necessary.
ExitApp
; ------------------------------------------------------------------------------
; Gui Subs
GuiClose:
Cancel:
Gui, Destroy
Return
CreateCert:
Gui, Destroy
Return
CopyCert:
Gui, Destroy
Return |
_________________ nick
denick @ http://de.autohotkey.com/forum/ |
|
| Back to top |
|
 |
OrelseIamfired
Joined: 13 Mar 2006 Posts: 60 Location: Ottawa, Canada
|
Posted: Tue Jul 03, 2007 3:34 pm Post subject: |
|
|
Hi Nick,
I am back from the long weekend. Happy Canada Day to me.
Thank you, that looks really good.
Thanks to Engunneer also.
Regards,
/ Louis |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|