Jump to content

Filesavedialog, gives 1 when canceled?


Recommended Posts

$savelocation = GUICtrlCreateInput(@HomeDrive & "\Log.log", 130, 400, 250, 20, $WS_DISABLED)

$dialog = FileSaveDialog( "Choose a name", @HomeDrive & "\", "all files (*.*)", 3, "Log.log")
GUICtrlSetData($savelocation, $dialog)

When i press cancel, it writes 1 in the Inputbox, how can i make it write "@Homedrive & "\Log.log"?

Link to comment
Share on other sites

$savelocation = GUICtrlCreateInput(@HomeDrive & "\Log.log", 130, 400, 250, 20, $WS_DISABLED)

$dialog = FileSaveDialog( "Choose a name", @HomeDrive & "\", "all files (*.*)", 3, "Log.log")
If @error Then
   GUICtrlSetData($savelocation, @Homedrive & "\Log.log")
Else
   GUICtrlSetData($savelocation, $dialog)
EndIf

Link to comment
Share on other sites

$savelocation = GUICtrlCreateInput(@HomeDrive & "\Log.log", 130, 400, 250, 20, $WS_DISABLED)

$dialog = FileSaveDialog( "Choose a name", @HomeDrive & "\", "all files (*.*)", 3, "Log.log")
If @error Then
   GUICtrlSetData($savelocation, @Homedrive & "\Log.log")
Else
   GUICtrlSetData($savelocation, $dialog)
EndIf

<{POST_SNAPBACK}>

Thx, played a bit with it, but it didn't seem to work for me...
Link to comment
Share on other sites

This works for me:

#include <GUIConstants.au3>
AutoItSetOption("TrayIconDebug", 1)

;Initialize variables
Global $style1
Global $IniFile
Global $GUIWidth
Global $GUIHeight

$GUIWidth = 250
$GUIHeight = 250
$IniFile = StringTrimRight(@ScriptFullPath, 3) & "ini"

;Only a close button:
;$style1 = BitOR($WS_POPUP, $WS_CAPTION, $WS_SYSMENU)
;GUICreate("New GUI", $GUIWidth, $GUIHeight, -1, -1, $style1)

GUICreate("New GUI", $GUIWidth, $GUIHeight)

$savelocation = GUICtrlCreateInput("", 10, 40, 250, 20, $WS_DISABLED)

GUISetState(@SW_SHOW)

$dialog = FileSaveDialog( "Choose a name", @HomeDrive & "\", "all files (*.*)", 3, "Log.log")
If @error Then
   GUICtrlSetData($savelocation, @Homedrive & "\Log.log")
Else
   GUICtrlSetData($savelocation, $dialog)
EndIf

While 1
   Sleep(25)
   $msg = GUIGetMsg()
   Select
   
      Case $msg = $GUI_EVENT_CLOSE
         GUIDelete()
         Exit

     ;Case $msg = ...

   EndSelect

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