TeTube Posted June 4, 2012 Share Posted June 4, 2012 Hello, i got a problem that i cant solve by my own. I want to create a .txt file in a dir i just created before. The .ini creation works for some reason. If I try to create the .txts in the same dir as my application, it works. expandcollapse popup; ----------------------------------------------------------------------- ; Paths ; ----------------------------------------------------------------------- Global Enum $statusStarted = -1, $statusPaused, $statusJoined, $statusFound Global $logPath = "\logs" ; Log Path. Global $imgPath = "\img" ; Image Path. Global $settingsPath = "\settings" ; Ini Path. Global $pickitPath = "\pickit" ; Ini Path. ; ----------------------------------------------------------------------- ; Files ; ----------------------------------------------------------------------- Global $itemFile = "log\itemlog.txt" ; Item log file. Global $logFile = "log\log.txt" ; Action log file. GLobal $iniFile = "settings\settings.ini" ; Settings ini file. GLobal $imgFile = "img\Item.jpg" ; Item image file. GLobal $pickitFile = "pickit\pickit.ini" ; pickit ini. _setup() Func _setup() ; Creates \log , \settings , \img and \pickit dir. DirCreate(@ScriptDir & $logPath) DirCreate(@ScriptDir & $settingsPath) DirCreate(@ScriptDir & $imgPath) DirCreate(@ScriptDir & $pickitPath) MsgBox(0, "Dir", "created dirs") ; Creates log.txt FileOpen($logFile, 0) FileClose($logFile) MsgBox(0, "log.txt", "created log.txt") ; Creates itemlog.txt FileOpen($itemFile, 0) FileClose($itemFile) MsgBox(0, "itemlog.txt", "created itemlog.txt") ; Creates pickit.ini IniWrite($pickitFile, "Rings", "Attribut1", 0) IniWrite($pickitFile, "Rings", "Attribut2", 0) IniWrite($pickitFile, "Amulets", "Attribute1", 0) IniWrite($pickitFile, "Amulets", "Attribute2", 0) MsgBox(0, "ini", "created pickit ini") ; Creates settings.ini IniWrite($iniFile, "RunCount", "RUNS", 0) IniWrite($iniFile, "RunCount", "FOUND", 0) IniWrite($iniFile, "Settings", "FIRST_RUN", 1) IniWrite($iniFile, "Checksum", "TOWN_CHECKSUM", 0) IniWrite($iniFile, "Checksum", "START_CHECKSUM", 0) IniWrite($iniFile, "Checksum", "RESUME_CHECKSUM", 0) IniWrite($iniFile, "Checksum", "TRINKET_CHECKSUM", 0) MsgBox(0, "ini", "created settings ini") EndFunc Could you help? Link to comment Share on other sites More sharing options...
GEOSoft Posted June 4, 2012 Share Posted June 4, 2012 Opening the file with the flag set to 0 won't create the file. That flag is Read mode.; Creates log.txt ;FileOpen($logFile, 0) ;FileClose($logFile) FileWrite($logFile, "");; no need for FileOpen/Close to create the file MsgBox(0, "log.txt", "created log.txt") If you insist on FileOpen/Close use FileOpen($LogFile, 2) ; or replace the 2 with a 1. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
TeTube Posted June 4, 2012 Author Share Posted June 4, 2012 thanks Link to comment Share on other sites More sharing options...
GEOSoft Posted June 5, 2012 Share Posted June 5, 2012 No problem but I should have also pointed out that there is seldom a reason to create a blank file. FileWrite() or FileWriteLine() will create the file if it doesn't exist. Also there really isn't a need to create the folder first either. FileOpen() with the flag set to 9 or 10 will create the path if it doesn't already exist. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
PhoenixXL Posted June 6, 2012 Share Posted June 6, 2012 (edited) _FileCreate() is an alternative though it uses the same functions as provided above Edited June 6, 2012 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
Kidney Posted June 6, 2012 Share Posted June 6, 2012 Would this be used for d3?? 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