Jump to content
Sign in to follow this  
bills

How do i open a textfile for writing some text?

Recommended Posts

bills

Im trying to at the end of my script open a textfile located on my desktop and write some info about what the script has done.

I can open a new instance of notepad and get it to enter the info like this:

Run("Notepad.exe")
WinWaitActive("Untitled - Notepad")
Send('Starttid: ' & $starttime & @CR & 'Antal gjorda länkbyten: ' & $Number & @CR & 'Sluttid: ' & _DateTimeFormat( _NowCalc(),0) & @CR & @CR)
WinWaitNotActive("Untitled - Notepad")

But i want it to open the file on my desktop instead and start writing at the bottom. The file is called "loggbok.txt" and is located at "C:\Documents and Settings\Bill\Desktop"

Any ideas guys?

//Bill

Share this post


Link to post
Share on other sites
Valuater

take a look at this

_FileWriteLog Writes current date,time and the specified text to a log file.

#include <File.au3>

_FileWriteLog ( $sLogPath, $sLogMsg )

Parameters

$sFilePath Path and filename of the file to be written to $sLogMsg Message to be written to the log file

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
bills

The thing is that i dont want the date and time stamp in the beginning. Otherwise this would have been great!

Share this post


Link to post
Share on other sites
Helge

Hei bills.

Do you want to add text on a new line at the bottom of the file each time ? Why not just this :

Global $FileName = @ScriptDir & "\data.dat"
Global $i="Your text"
FileWriteLine($FileName,$i)
Edited by Helge

Share this post


Link to post
Share on other sites
Valuater

Hei bills.

Do you want to add text on a new line at the bottom of the file each time ? Why not just this :

Global $FileName = @ScriptDir & "\data.dat"
Global $i="Your text"
FileWriteLine($FileName,$i)
I was thinking the same thing Helge

8)


NEWHeader1.png

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  

×