set currDate to current date
set yr to year of currDate as text
set mt to month of currDate as number
set dy to day of currDate
set hs to hours of currDate
set ms to minutes of currDate
set sc to seconds of currDate
set newName to yr & "-" & ¬
(text -2 through -1 of ("0" & mt)) & "-" & ¬
(text -2 through -1 of ("0" & dy)) & " " & ¬
(text -2 through -1 of ("0" & hs)) & "-" & ¬
(text -2 through -1 of ("0" & ms)) & "-" & ¬
(text -2 through -1 of ("0" & sc)) & ¬
".rtf"
set path2Doc to (path to documents folder as text) & "Diary:Latest:"
set path2Doc to (path to documents folder as text) # your subfolders don't exist on my mac
tell application "System Events"
make new file at end of folder path2Doc with properties {name:newName}
end tell
set newFile to (path2Doc & newName) as alias
tell application "TextEdit"
activate
make new document
save document 1 in newFile
end tell
set newName to do shell script "date +'%Y-%m-%d %H-%M-%S.rtf'"
set path2Doc to (path to documents folder as text) & "Diary:Latest:"
set path2Doc to (path to documents folder as text) # your subfolders don't exist on my mac
#set newName to (theDate & ".rtf") as text
tell application "System Events"
make new file at end of folder path2Doc with properties {name:newName}
end tell
set newFile to (path2Doc & newName) as alias
tell application "TextEdit"
activate
make new document
save document 1 in newFile
end tell
Yvan KOENIG (VALLAURIS, France) samedi 22 décembre 2012 18:56:00