demo
set.ini
[set]
documentfolder=My Documents
default=USERPROFILE
last=
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 449, 192, 114)
$Input1 = GUICtrlCreateInput("Input1", 40, 40, 417, 21)
$Button1 = GUICtrlCreateButton("Button1", 512, 32, 73, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$defaultdir = EnvGet(IniRead(@ScriptDir & "\set.ini", "set", "default", "")) & "\" & IniRead(@ScriptDir & "\set.ini", "set", "documentfolder", "")
$lastdir = IniRead(@ScriptDir & "\set.ini", "set", "last", "")
If $lastdir = "" Then
$lastdir = $defaultdir
EndIf
GUICtrlSetData($Input1, $lastdir)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
IniWrite(@ScriptDir & "\set.ini", "set", "last", $lastdir)
Exit
Case $Button1
$folder = FileSelectFolder("请选择目录", "")
If $folder <> "" Then
If $folder <> $lastdir Then
$lastdir = $folder
GUICtrlSetData($Input1, $lastdir)
EndIf
EndIf
EndSwitch
WEnd
|