AsYLuM Posted July 1, 2006 Posted July 1, 2006 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.
Moderators SmOke_N Posted July 1, 2006 Moderators Posted July 1, 2006 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 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.
w0uter Posted July 1, 2006 Posted July 1, 2006 (edited) @CR/@LF/@CRLF [edit] i hate you ron [/edit] Edited July 1, 2006 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
Moderators SmOke_N Posted July 1, 2006 Moderators Posted July 1, 2006 @CR/@LF/@CRLF [edit] i hate you ron [/edit] 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.
AsYLuM Posted July 1, 2006 Author Posted July 1, 2006 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?
PsaltyDS Posted July 1, 2006 Posted July 1, 2006 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! 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
Moderators SmOke_N Posted July 1, 2006 Moderators Posted July 1, 2006 (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 July 1, 2006 by SmOke_N 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.
AsYLuM Posted July 1, 2006 Author Posted July 1, 2006 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
Moderators SmOke_N Posted July 1, 2006 Moderators Posted July 1, 2006 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 I think you can handle that one on your own, the help file is pretty detailed. 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.
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