gkrapp Posted April 9, 2004 Share Posted April 9, 2004 dear all,this is my first script i'm trying to write with autoit_v3.it's a kind of logon script which will also add a line to an log-file.here's a part of my sample code, but i still don't know how to writean variable as text to the file.$logfile = FileOpen ("\\server\logfiles$\login.log" , 1)FileWriteLine ($logfile, '@username logged on to @computername at @MDAY.@MON.@YEAR on @HOUR:@MIN' )FileClose ($logfile)actually inside the logfile only "@username" and all this stuff is written.any help would be appreciated! thank a lot in advancegreetzgerhard Link to comment Share on other sites More sharing options...
scriptkitty Posted April 9, 2004 Share Posted April 9, 2004 (edited) very close, just need variables and @macros to be outside of strings: $logfile = FileOpen ("\\server\logfiles$\login.log" , 1) FileWriteLine ($logfile, @username & ' logged on to ' & @computername&' at '& @MDAY & '.' & @MON & '.' & @YEAR & ' on ' & @HOUR & ':' &@MIN) FileClose ($logfile) usage is @clrf & $var & 'I am a string' not '@crlf $var I am a string' ...edit and if you are just appending a line to a file, you can skip the file open and close, it will do it automatically if a filename is given. FileWriteLine ("\\server\logfiles$\login.log", @username & ' logged on to ' & @computername&' at '& @MDAY & '.' & @MON & '.' & @YEAR & ' on ' & @HOUR & ':' &@MIN) Edited April 9, 2004 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
gkrapp Posted April 9, 2004 Author Share Posted April 9, 2004 hey, it works very well! thanks for your support and also for your tip! gerhard 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