Jump to content
Sign in to follow this  
TheOnlyOne

how to create own file?

Recommended Posts

TheOnlyOne

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?

Share this post


Link to post
Share on other sites
qazwsx

fileopen

Share this post


Link to post
Share on other sites
somdcomputerguy

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 by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
TheOnlyOne

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

Share this post


Link to post
Share on other sites
nguyenbason

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

Share this post


Link to post
Share on other sites
somdcomputerguy

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

Share this post


Link to post
Share on other sites
TheOnlyOne

okay last problem when it saved it isent like a txt file ? like i set it to be in the save dialog why not ?

Share this post


Link to post
Share on other sites
nguyenbason

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 by nguyenbason

UnderWorldVN- Just play the way you like it

Share this post


Link to post
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
Sign in to follow this  

×