Sunday, March 28, 2010

AppleScript로 새 text파일 생성하기/ Date/Time 찍기

Creating files and writing to them from AppleScript is a little complicated. It's easier to use AppleScript for what it's really intended for: automating existing applications.
tell application "TextEdit"
activate
make new document
set theDate to current date
set text of document 1 to theDate as text
save document 1 in "/Users/robbie/Desktop/LastUpdate.txt"
end tell
날짜 시간 찍는 방법에 대해 보충:
Or you could use the shell.
do shell script "date > $HOME/Desktop/LastUpdate.txt"
If you want a running record of when the updates were ran do this (double >> )
do shell script "date >> $HOME/Desktop/LastUpdate.txt"
레퍼런스 :
Simple Applescript: Create a .txt file

No comments:

Post a Comment