0411名称未設定
2014/12/11(木) 00:16:19.33ID:/xJryEhL0>>410
うまくいきました
よくみたら日時を挿入するまえに同じことをしてたんですね
全体でこんなかんじになりました。
遅くまでおつきあいしてくれて感謝しています。ありがとうございました。
--CotEditorでファイルを開いて文末に日時を挿入
--ファイルパスの例"/Users/ユーザー名/Desktop/ファイル名.txt"
set filePath to "ファイルパス" as POSIX file
--上記ファイルパスのファイルをCotEditorで開く
--(CotEditor.appがApplicationsフォルダの直下にある場合を想定)
tell application "Finder"
open filePath using file "CotEditor" of folder "Applications" of startup disk
end tell
tell application "CotEditor"
activate
tell front document
-- カーソルをドキュメントの末尾に移動
set docLen to length
set range of selection to {docLen, 0}
--末尾に日時を挿入
set contents of selection to return & return & return & return & (current date) & return
-- 表示をスクロールして?カーソルをドキュメントの末尾に移動
set theRange to range of selection
scroll to caret
set docLen to length
set range of selection to {docLen, 0}
end tell
end tell