「ファイル(選択範囲)の仮保存」の版間の差分
ナビゲーションに移動
検索に移動
SyntaxHighlightにcopyの追加 |
変数にvarの宣言を追加 |
||
| 17行目: | 17行目: | ||
function tail() { | function tail() { | ||
d = new Date; | var d = new Date; | ||
return "." + d.getTime() + ".TMP"; | return "." + d.getTime() + ".TMP"; | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
2025年11月25日 (火) 06:48時点における最新版
- 選択範囲を“編集中のファイル名"+数字13桁+".TMP"というファイル名で保存します。
- 数字部分は、1970 年 1 月 1 日午前 00:00:00 以降のミリ秒です。
// saveAstemporary.js
// 2013-01-19
var s = Editor.ActiveDocument.Selection.Text;
if ( s.length == 0 ) { Quit() ;}
var filename = document.FullName;
Editor.NewFile();
var newdoc = Editor.Documents.Item( Editor.Documents.Count-1 );
newdoc.Write( s );
newdoc.save( filename + tail() );
newdoc.saved = true;
newdoc.close();
function tail() {
var d = new Date;
return "." + d.getTime() + ".TMP";
}
スポンサーリンク