#include <GuiConstantsEx.au3>
$sFile1 = @ScriptDir & "\Test1.txt"
$sFile2 = @ScriptDir & "\Test2.txt"
$sFileContent = FileRead($sFile1)
$GUI = GUICreate("Test Script", 300, 200)
$Edit_config = GUICtrlCreateEdit($sFileContent, 20, 20, 260, 120)
$Save_Button = GUICtrlCreateButton("Save", 20, 160, 60, 20)
$rbText1 = GUICtrlCreateRadio("text1", 104, 160, 57, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$rbText2 = GUICtrlCreateRadio("text2", 176, 160, 65, 17)
GUISetState(@SW_SHOW, $GUI)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $rbText1
$sFileContent = FileRead($sFile1)
If @error = 1 Then
$sFileContent = "Can't find file text1.txt"
EndIf
GUICtrlSetData ($Edit_config, $sFileContent)
$sFile = $sFile1
Case $rbText2
$sFileContent = FileRead($sFile2)
If @error = 1 Then
$sFileContent = "Can't find file text2.txt"
EndIf
GUICtrlSetData ($Edit_config, $sFileContent)
$sFile = $sFile2
Case $Save_Button
$sEditContent = GUICtrlRead($Edit_config)
If $sEditContent <> $sFileContent Then
$sFileContent = $sEditContent
$hFOpen = FileOpen($sFile, 2)
FileWrite($hFOpen, $sFileContent)
FileClose($hFOpen)
MsgBox(64, "Done!", "Data is saved!", 0, $GUI)
Else
MsgBox(48, "Attention!", "There is no changes to the data.", 0, $GUI)
EndIf
EndSwitch
WEnd
получилось, разбираюсь почему...
$sFile1 = @ScriptDir & "\Test1.txt"
$sFile2 = @ScriptDir & "\Test2.txt"
$sFileContent = FileRead($sFile1)
$GUI = GUICreate("Test Script", 300, 200)
$Edit_config = GUICtrlCreateEdit($sFileContent, 20, 20, 260, 120)
$Save_Button = GUICtrlCreateButton("Save", 20, 160, 60, 20)
$rbText1 = GUICtrlCreateRadio("text1", 104, 160, 57, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$rbText2 = GUICtrlCreateRadio("text2", 176, 160, 65, 17)
GUISetState(@SW_SHOW, $GUI)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $rbText1
$sFileContent = FileRead($sFile1)
If @error = 1 Then
$sFileContent = "Can't find file text1.txt"
EndIf
GUICtrlSetData ($Edit_config, $sFileContent)
$sFile = $sFile1
Case $rbText2
$sFileContent = FileRead($sFile2)
If @error = 1 Then
$sFileContent = "Can't find file text2.txt"
EndIf
GUICtrlSetData ($Edit_config, $sFileContent)
$sFile = $sFile2
Case $Save_Button
$sEditContent = GUICtrlRead($Edit_config)
If $sEditContent <> $sFileContent Then
$sFileContent = $sEditContent
$hFOpen = FileOpen($sFile, 2)
FileWrite($hFOpen, $sFileContent)
FileClose($hFOpen)
MsgBox(64, "Done!", "Data is saved!", 0, $GUI)
Else
MsgBox(48, "Attention!", "There is no changes to the data.", 0, $GUI)
EndIf
EndSwitch
WEnd
получилось, разбираюсь почему...