Making a log file
Making a log file
- Subject: Making a log file
- From: "Timothy K. Wilkinson" <email@hidden>
- Date: Thu, 01 Mar 2001 10:41:13 -0500
I'm trying to create an application that will log a user's id on our lab
machines to a SimpleText file. We just want to track which users are using
what machines. I've got a script that does everything I want it to do
except one thing. It will only write one line of information. It replaces
the information at the top of the file every time a new user logs in. It
seems like this should be an easy thing to do with AppleScript but I can't
seem to make it work. How do you make AppleScript return and append a new
line of information to a text file every time it's used?
Here's the script I'm using. It uses Akua Sweets's "compile list" feature:
tell application "Finder"
set loginFile to "Macintosh HD:login.txt"
set lineCount to (count of lines in loginFile)
display dialog "Please enter your UVA ID:" default answer "" buttons
"OK" default button "OK"
set userID to text returned of result as text
set cname to (owner name) as text
set cDate to (current date) as text
set loginInfo to (compile list {userID, cname, cDate} with row delimiter
tab with column delimiter return)
write loginInfo to loginFile
end tell
Any help is much appreciated.
Tim Wilkinson
ITC-ACHS
University of Virginia
email@hidden
email@hidden