Tapeworm Posted April 17, 2008 Share Posted April 17, 2008 hi guys, Im trying to make a script through which you can write to a .txt file without opening it. for example $var = inputbox("???","???") then i want to save $var into a .txt file on line 2 (for example), without actually opening the .txt file ofcourse. any ideas how i can do this? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted April 17, 2008 Share Posted April 17, 2008 Check FileWrite() and/or FileWriteLine() in the helpfile! .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Tapeworm Posted April 17, 2008 Author Share Posted April 17, 2008 as far as I understand, you need the .txt file open for that. I want to write to the .txt file while its closed. or did i miss something ? Link to comment Share on other sites More sharing options...
monoceres Posted April 17, 2008 Share Posted April 17, 2008 as far as I understand, you need the .txt file open for that. I want to write to the .txt file while its closed. or did i miss something ?That doesn't make any sense, that's like asking how to access a safe without opening it. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
JustinReno Posted April 17, 2008 Share Posted April 17, 2008 @OP: Its impossible to write to a file without opening it. You do not have to use the file open function (_FileOpen()), just use FileWrite. It will open and close the handle as needed. Link to comment Share on other sites More sharing options...
Squirrely1 Posted April 18, 2008 Share Posted April 18, 2008 #include <File.au3> _FileWriteToLine ( $sFile, $iLine, $sText [, $fOverWrite] ) Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
AU3Newbie Posted April 18, 2008 Share Posted April 18, 2008 @OP:Its impossible to write to a file without opening it. You do not have to use the file open function (_FileOpen()), just use FileWrite. It will open and close the handle as needed.In Au3 HELP FILE,use fileopen and fileclose is needed.I dunno why the help file tell us to do this,while AHK Fileappend needed in HELP FILE. Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 18, 2008 Share Posted April 18, 2008 (edited) In Au3 HELP FILE,use fileopen and fileclose is needed.I dunno why the help file tell us to do this,while AHK Fileappend needed in HELP FILE.When you open the file with FileOpen() first, it gives you more options, that's all. If you pass a string path to FileWrite(), you will get the default behavior of appending in ANSI format (with an exception that binary data will be appended in binary "byte by byte"). If you want anything other than that default behavior, you need to use FileOpen() first to define your preference and pass the handle to FileWrite().The _FileWriteToLine() function does not accept a handle, because it needs control over the mode as it switches between reading and writing to the file.Perhaps the help file could be clearer on that point, but the behavior is logical and consistent. P.S. There is not now, nor will there ever be, any effort here to make AutoIt resemble AHK, so why bring that up? Edited April 18, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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