Jump to content

Help with savedialog option


lyledg
 Share

Recommended Posts

Guys

I 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 = 1

Func Savelog()

$savlog = FileSaveDialog( "Choose a name.", @Scriptdir, "Scripts (*.log)", 1)

If @error = $Cancel then

exit

Else

Filewrite($savlog, "")

Endif

   

Endfunc

Cheers

Lyle

Link to comment
Share on other sites

Func Savelog()

$savlog = FileSaveDialog( "Choose a name.", @Scriptdir, "Scripts (*.log)", 1)

If @error then 
Return
Else
Filewrite($savlog, "")
Endif
    
Endfunc
Try this.

<{POST_SNAPBACK}>

Nope, that didn't work...still getting the same result
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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