OK, Here’s what I’m trying to do:
I want to take the current date at the time the script is ran and write it to a new line in a text file. I can get a text file opened in TextEdit and write stuff to it, but the current date just shows up in the text file as jibberish. I don’t know how to coherce it into plain text and spit that into the next line of the text file and then save and close it. I don’t even know if it’s possible in text edit, so I’m kinda lost. I’ve looked through the TextEdit dictionary and it’s just not clicking with me. Eventually, I’d like to write the current date time to a cell in excel, but that’s WAY over my ability at this time, so I figured I’d start by trying to write it to a text file and work up to the excel thing later. It’s more or less a time clock that I can punch in and out of by clicking on the applescript app.
I’m a real newby to applescript and I’m no programmer, so please forgive my ignorance.
Thanks for any suggestions.
-Shawn
try
set d to current date --> a date object: date "Wednesday, May 12, 2004 1:06:03 PM"
set s to (d as string) & return --> a string: "Wednesday, May 12, 2004 1:06:22 PMr"
set f to open for access "Mac HD:Time Stamp File" with write permission
set len to get eof f -- last char of file
write s to f starting at (len + 1) -- write to end of file
close access f
on error e number n from f to t partial result p
-- errors will leave the file open, so try to close it
try
close access f
end try
error e number n from f to t partial result p
end try
That works great!
Thanks a bunch!