「ファイル(選択範囲)の仮保存」の版間の差分
ナビゲーションに移動
検索に移動
ハイライト効果の適用 |
変数にvarの宣言を追加 |
||
| (同じ利用者による、間の2版が非表示) | |||
| 2行目: | 2行目: | ||
*数字部分は、1970 年 1 月 1 日午前 00:00:00 以降のミリ秒です。 | *数字部分は、1970 年 1 月 1 日午前 00:00:00 以降のミリ秒です。 | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript" copy> | ||
// saveAstemporary.js | // saveAstemporary.js | ||
// 2013 | // 2013-01-19 | ||
var s = Editor.ActiveDocument.Selection.Text; | var s = Editor.ActiveDocument.Selection.Text; | ||
| 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";
}
スポンサーリンク