TheOnlyOne Posted June 22, 2009 Share Posted June 22, 2009 like the title says how can i create my own file ? i tryed to look at the help file but only function i can find is _createfile but dosent seems to work for me ? i also tryed installfile but dont work ether? Link to comment Share on other sites More sharing options...
qazwsx Posted June 22, 2009 Share Posted June 22, 2009 fileopen Link to comment Share on other sites More sharing options...
somdcomputerguy Posted June 22, 2009 Share Posted June 22, 2009 (edited) like the title says how can i create my own file ?i tryed to look at the help file but only function i can find is _createfile but dosent seems to work for me ? i also tryed installfile but dont work ether?This is in helpfile too, Function FileOpen. If filename given doesn't exist, it is created. This helps you? Edited June 22, 2009 by snowmaker - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
TheOnlyOne Posted June 23, 2009 Author Share Posted June 23, 2009 hmm im not totaly sure this what i tryed and that dosent work at all ? just to explain the program its suposed to do so you can save that you have writen in your edit box ? and load it agian later but this dosent work ether #include <ButtonConstants.au3> #include <DateTimeConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <File.au3> #Region ### START Koda GUI section ### Form=C:\Documents and Settings\lo\Skrivebord\auto it games\logbog\Form1.kxf $MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}" $Form1 = GUICreate("Form1", 633, 447, 193, 125) $MonthCal1 = GUICtrlCreateMonthCal("2009/06/23", 16, 16, 191, 154) $Button1 = GUICtrlCreateButton("Save", 8, 368, 75, 25, 0) $Button2 = GUICtrlCreateButton("Load", 128, 368, 75, 25, 0) $Edit1 = GUICtrlCreateEdit("", 16, 192, 185, 153) $MenuItem1 = GUICtrlCreateMenu("MenuItem1") $MenuItem2 = GUICtrlCreateMenuItem("MenuItem2", $MenuItem1) $MenuItem3 = GUICtrlCreateMenuItem("MenuItem3", $MenuItem1) $MenuItem4 = GUICtrlCreateMenu("MenuItem4") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $button1 $read1=guictrlread ($edit1) $read2=guictrlread($MonthCal1) $var = FileSaveDialog( "choose place to save", $MyDocsFolder, "Text files (*.txt)", 2) fileopen($var&$read2,9) EndSwitch WEnd Link to comment Share on other sites More sharing options...
nguyenbason Posted June 23, 2009 Share Posted June 23, 2009 How can you write to a file while you open it but don't write something to it? case $button1 $read1=guictrlread ($edit1) $read2=guictrlread($MonthCal1) $var = FileSaveDialog( "choose place to save", $MyDocsFolder, "Text files (*.txt)", 2) fileopen($var,1) filewriteline($var, $read1) filewriteline($var, $read2) fileclose($var) UnderWorldVN- Just play the way you like it Link to comment Share on other sites More sharing options...
somdcomputerguy Posted June 23, 2009 Share Posted June 23, 2009 $var = FileSaveDialog( "choose place to save", $MyDocsFolder, "Text files (*.txt)", 2)fileopen($var&$read2,9)After opening a file, one must write to it, then close it. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
TheOnlyOne Posted June 23, 2009 Author Share Posted June 23, 2009 okay last problem when it saved it isent like a txt file ? like i set it to be in the save dialog why not ? Link to comment Share on other sites More sharing options...
nguyenbason Posted June 23, 2009 Share Posted June 23, 2009 (edited) Because default you type the name without txt then your program don't check for it. You must check if .txt is typed into file name Case $button1 $Read1 = GUICtrlRead($Edit1) $Read2 = GUICtrlRead($MonthCal1) $var = FileSaveDialog("choose place to save", $MyDocsFolder, "Text files (*.txt)", 2) If StringRight($var,4) <> ".txt" Then $var = $var & ".txt" EndIf FileOpen($var, 1) FileWriteLine($var, $read1) FileWriteLine($var, $read2) FileClose($var) Edited June 23, 2009 by nguyenbason UnderWorldVN- Just play the way you like it 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