lyledg Posted November 27, 2004 Posted November 27, 2004 GuysI have a function called from within my script after a checkbox is selected. The "Save dialog" box comes up and I enter a filename for the log file to be saved to, but once I click "Save", the routine loops and I again am faced with a "Save Dialog" option. How do I end this routine after the file has been saved. I have tried using "exit", but that completely ends my whole proggie...All I am wanting to do is end the "Save Dialog" routine...not the whole script?Also, if the "Cancel" button is clicked, I want it to go back to my original form, not completely close.Global $Cancel = 1Func Savelog()$savlog = FileSaveDialog( "Choose a name.", @Scriptdir, "Scripts (*.log)", 1)If @error = $Cancel then exitElse Filewrite($savlog, "")Endif EndfuncCheersLyle
MHz Posted November 27, 2004 Posted November 27, 2004 (edited) Func Savelog() $savlog = FileSaveDialog( "Choose a name.", @Scriptdir, "Scripts (*.log)", 1) If @error then Return Else Filewrite($savlog, "") Endif EndfuncTry this. Edited November 27, 2004 by MHz
lyledg Posted November 27, 2004 Author Posted November 27, 2004 Func Savelog() $savlog = FileSaveDialog( "Choose a name.", @Scriptdir, "Scripts (*.log)", 1) If @error then Return Else Filewrite($savlog, "") Endif EndfuncTry this.<{POST_SNAPBACK}>Nope, that didn't work...still getting the same result
MHz Posted November 27, 2004 Posted November 27, 2004 Here is a gui. It stays open when the dialog is closed. I am not sure, I understand your problem?#include <GUIConstants.au3> GUICreate("My GUI") $button = GUICtrlCreateButton('Button', 20, 20) GUISetState (@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop if $msg = $button Then Savelog() Wend Func Savelog() $savlog = FileSaveDialog( "Choose a name.", @Scriptdir, "Scripts (*.log)", 1) If @error then Return Else ;~ Filewrite($savlog, "") MsgBox(4096,'debug:' , '$savlog:' & $savlog);### Debug MSGBOX Endif Endfunc
lyledg Posted November 27, 2004 Author Posted November 27, 2004 Thanx MHz, your example works but I think the reason I am having this issue is because I am calling the function from a Checkbox enable. Tha means that it will loop because the checkbox is still enabled even though I have saved the log file. I only really want to run the save log file once....I guess a FOR...NEXT loop will do the trick... Cheers for your help.. Lyle
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