Sign in to follow this  
Followers 0
t0ddie

fileappend

8 posts in this topic

about fileappend...

please give me a straightforward answer. i dont want any grief.

the command is NOT in the help file.

YES i saw the function _fileappend

i still dont know what to do

please show an example of how to append text to the end of a .txt file

thanks


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites



I bet if you search for the word "Append" in the helpfile you will find it... :ph34r:


Who else would I be?

Share this post


Link to post
Share on other sites

this-is-me, nope

larry, yup

$file = FileOpen("test.txt", 0)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

FileWriteLine (test.txt, "hello" )

FileClose($file)

that should do it.

thanks


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

Search for "Library Function Reference: File.au3" in the help file.

Functions that begin with the underscore character are user-defined functions, and many of these come with AutoIt when installed (typically located at "C:\Program Files\AutoIt3\Include")

Function: _FileAppend( $sFilePath, $sText ) 

 Description:      Appends the specified text to a file.
 Syntax:           _FileAppend( $sFilePath, $sText )
 Parameter(s):     $sFilePath - Path and filename to the file
                   $sText     - Text to be appended to the file
 Requirement(s):   None
 Return Value(s):  On Success - Returns 1
                   On Failure - Returns 0 and sets:
                                @error = 1: Error opening specified file
                                @error = 2: File could not be written to
 Author(s):        Brian Keene <brian_keene@yahoo.com>
 Note(s):          If the text to be appended does NOT end in @CR or @LF then
                   a DOS linefeed (@CRLF) will be automatically added.

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

I bet if you search for the word "Append" in the helpfile you will find it...

Some good advice from this-is-me.

I get in help guide:

Functions
Function FileOpen
Function FileWrite
Function FileWriteLine

Most of the commands needed. :ph34r:

Share this post


Link to post
Share on other sites

hello

i put this script on my desktop along with TEST.txt and it works perfectly

$bak = ClipGet()

$file = FileOpen("TEST.txt", 0)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

FileWriteLine("TEST.txt", $bak )

FileClose($file)

but when i use it in my script, it gives me the error

MsgBox(0, "Error", "Unable to open file.")

i have the script and the .txt file in the same directory.

i dont know whats wrong.. do i need to post the whole script?


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

hiya,

try this:

$bak = ClipGet()

$file = FileOpen(@ScriptDir & "\TEST.txt", 1)
If $file = -1 Then
  MsgBox(0, "Error", "Unable to open file.")
  Exit
EndIf
FileWriteLine($file, $bak)
FileClose($file)

Btw: If you don't use FileOpen with parameter "1" and "$file" in your FileWriteLine, then you wouldn't need FileOpen-FileClose at all.

See help-file on FileWriteLine:

If a filename is given rather than a file handle, the file will be opened and closed during the function call. For parsing large text files this will be much slower than using filehandles. However, filename will be created if it does not already exist.

Greetings,

ZeD

Share this post


Link to post
Share on other sites

greetings zed

thanks.

that was most easy to correct.


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

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  
Followers 0