Login Applescript won't write to file
Login Applescript won't write to file
- Subject: Login Applescript won't write to file
- From: "Timothy K. Wilkinson" <email@hidden>
- Date: Thu, 28 Jun 2001 11:58:55 -0400
I've got a very aggravating AppleScript problem I'd love some input on. We
have a sign in sheet in our computer labs to keep track of users. I wrote
an AppleScript that displays a dialog box. The user enters their id in the
box and the script writes that and the computer name, date and time to a
text file on our server. The script works perfectly when I run it from
Script Editor. When I run it using iDo Script Scheduler it runs fine and
even thinks it has written to the text file yet nothing shows up in it. Any
ideas why it would write to that file when run from Script Editor but not
when it runs alone?
--------------------Begin Script ----------------
set loginFile to "
Data:log:lablogin.txt"
--set a flag to check if the email is a UVA ID
set idFlag to ""
repeat until idFlag is "true"
display dialog "Please enter your UVA Computing ID:" default answer
"" buttons "OK" default button "OK"
set userID to text returned of result as text
--checks to make sure the ID is valid
set idCount to (count of userID)
set the disallowed_characters to {"0", "1", "2", "3", "4", "5", "6",
"7", "8", "9"}
if character 1 of userID is in the disallowed_characters or
character 2 of userID is in the disallowed_characters or ,
character idCount of userID is in the disallowed_characters or
idCount > 6 or userID = "" or idCount < 2 or (userID = cname) then
display dialog "Please enter a UVA Computing ID" & return &
"Example: abc2d" buttons "OK" default button "OK"
set idFlag to "false"
else
set idFlag to "true"
end if
end repeat
set cname to (computer name) as text
--this call uses the OSAX "date string for"
set cDate to date string for (current date) in short format
set the cTime to my format_time_using(the current date, ":", {"HH",
"MM", "SS"})
set login_time to (cDate & space & cTime) as text
--writes all the information to loginData
set loginData to ("login" & " " & userID & " " & cname & " " &
cname & " " & login_time & (ASCII character 13) & (ASCII character 10))
as text
--writes the information to a text file as tab-delimited
write loginData to file loginFile starting at eof
end tell
------------------End Script------------
TIA,
Tim Wilkinson
ITC-ACHS
University of Virginia
email@hidden
email@hidden