- 2006-09-22 (金)
- AppleScript
変数の内容をテキストファイルに書き出す(追記)する AppleScript のサンプルです。
デスクトップに「test.txt」と言う名前のファイルが存在しない場合、新規作成します。ファイルが既に存在していれば追記。
tell application "Finder"
set aText to ("日本語のサンプル文字列" & return)
set aTextFile to open for access ((desktop as text) & "test.txt") with write permission
set aEOF to get eof of aTextFile
try
write aText starting at (aEOF + 1) to aTextFile
on error aErrorText
display dialog aErrorText
end try
close access aTextFile
end tell
日本語を書き出す時、文字コードはどうなるんだろう?
動作確認:Mac OS 10.4.7
関連する記事
- Newer: Movable Type で特別なページを作る方法
- Older: ページを印刷する JavaScript のサンプル
Comments: 0
Trackback+Pingback: 0
- TrackBack URL for this entry
- http://bowz.info/1239/trackback
- Listed below are links to weblogs that reference
- [ AppleScript ] 変数の内容をテキストファイルに書き出すサンプル from Bowz::Notebook