gcue Posted June 3, 2008 Share Posted June 3, 2008 theres an option in FileSaveDialog for prompting for replacement. would it be possible at all to include an option for appending? text file appending for instance. Link to comment Share on other sites More sharing options...
Monamo Posted June 3, 2008 Share Posted June 3, 2008 theres an option in FileSaveDialog for prompting for replacement. would it be possible at all to include an option for appending? text file appending for instance.Here's an example (basically, using FileOpen(in append mode) instead of FileSave, then FileWriteLine for the new data): expandcollapse popup#include <GUIConstants.au3> AutoItSetOption("GUIOnEventMode", 1) $GUITitle = "Append to file example" $GUIWidth = 400 $GUIHeight = 300 $GUI = GUICreate($GUITitle, $GUIWidth, $GUIHeight, (@DesktopWidth - $GUIWidth) / 2, (@DesktopHeight - $GUIHeight) / 2) $editBody = GUICtrlCreateEdit("", 10, 10, $GUIWidth - 20, $GUIHeight - 40) $buttonAppend = GUICtrlCreateButton("Append to existing file...", 10, $GUIHeight - 20, $GUIWidth - 20, 20, $BS_FLAT) GUISetState() #Region Events list GUISetOnEvent($GUI_EVENT_CLOSE, "_ExitIt") GUICtrlSetOnEvent($buttonAppend, "_AppendData") #EndRegion Events list While 1 Sleep(10) WEnd Func _AppendData() $sFile = "" If GUICtrlRead($editBody) <> "" Then $sFile = FileOpenDialog("Select destination file...", @ScriptDir, "Text files (*.txt)", 8) If Not @error Then $hFile = FileOpen($sFile, 1) FileWriteLine($hFile, GUICtrlRead($editBody)) If @error Then MsgBox(48, "Error", "Error appending data to target file.") EndIf FileClose($hFile) EndIf EndIf EndFunc Func _ExitIt() Exit EndFunc - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
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