Sign in to follow this  
Followers 0
AsYLuM

Newbie here, New Line?

10 posts in this topic

What is the script I use to make a new line?

FileWrite($file, "["& @Year&"."&@mon&"."&@mday&" "&@HOUR & ":" &@MIN & ":" &@SEC & '] Window: "'& $window& '"'& $what2log & )

I need to make a new line so every time the date/time is desplayed, it is on a new line.

Share this post


Link to post
Share on other sites



What is the script I use to make a new line?

FileWrite($file, "["& @Year&"."&@mon&"."&@mday&" "&@HOUR & ":" &@MIN & ":" &@SEC & '] Window: "'& $window& '"'& $what2log & )

I need to make a new line so every time the date/time is desplayed, it is on a new line.

@LF

@CR

@CRLF


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Sorry. Will do next time :D

Share this post


Link to post
Share on other sites

@CR/@LF/@CRLF

[edit] i hate you ron [/edit]

:D:D:):D:wacko:

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Argg. I thought I had it, but something is wrong

FileWrite(@CRLF & $file, "["& @Year&"."&@mon&"."&@mday&" "&@HOUR & ":" &@MIN & ":" &@SEC & '] Window: "'& $window& "'"

& $what2log)

I want the results to come up like:

[May 21, 2006 @ 4:40]

[Window - Google.com - Microsoft Internet Explorer]

BLAH BLAH BALHY (you know, the what2log var)

[May 21, 2006 @ 4:40]

[Window - Google.com - Microsoft Internet Explorer]

BLAH BLAH BALHY (you know, the what2log var)

[May 22, 2006 @ 4:40]

[Window - Google.com - Microsoft Internet Explorer]

BLAH BLAH BALHY (you know, the what2log var)

[May 23, 2006 @ 4:40]

[Window - Google.com - Microsoft Internet Explorer]

BLAH BLAH BALHY (you know, the what2log var)

Can someone help me format this?

Share this post


Link to post
Share on other sites

What is the script I use to make a new line?

FileWrite($file, "["& @Year&"."&@mon&"."&@mday&" "&@HOUR & ":" &@MIN & ":" &@SEC & '] Window: "'& $window& '"'& $what2log & )

I need to make a new line so every time the date/time is desplayed, it is on a new line.

As you've already heard, you can add "& @CRLF" to your string, but you can also use FileWriteLine(). Which does that for you. From your formatting, it looks like a log file entry, for which you can use _FileWriteLog(), adding the timestamp automaticaly:

#include <file.au3>

$LogFile = "C:\Logs\MyLog.log"
_FileWriteLog($LogFile, "This is the first log entry.")
_FileWriteLog($LogFile, "This is the second line in the log..." & @CRLF & _
     @Tab & "...and this is the third line!.")
$LogMsg = "This is the fourth line of the log."
_FileWriteLog($LogFile, $LogMsg)

Cheers! :D


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

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Your using @CRLF in the file location?

Try this:

FileWrite($file, @CRLF & "["& @Year&"."&@mon&"."&@mday&" "&@HOUR & ":" &@MIN & ":" &@SEC & ']' & _
            @CRLF & 'Window: "'& $window & '"' & _
            @CRLF & $what2log)

Edit:

PsaltyDS's suggestion is a better one IMO... I also edited "'" to '"' because you had a double quote leading and a single quote ending.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I see, You define the FileWrite, then display it. Okay, now I want to add a message before anything happens that is a msgbox saying they are being logged for IT purposes. Just with an OK button.

MsgBox?

I might be stuck in VB mode :D

Share this post


Link to post
Share on other sites

I see, You define the FileWrite, then display it. Okay, now I want to add a message before anything happens that is a msgbox saying they are being logged for IT purposes. Just with an OK button.

MsgBox?

I might be stuck in VB mode :D

I think you can handle that one on your own, the help file is pretty detailed.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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