#4253
yunoki
メンバー

=====================================
名前:文書を連結するマクロ
版:1.0
用途:開いているファイルをひとつにまとめます
コメント:プログラム開発時のステップ数を調べたりするときに便利です
=====================================

/**************************************************************
* 文書を連結するマクロ
**************************************************************/
var loadText = {
allText : new String(),
setDoc : function ( doc ){ this.doc = doc },
add : function (){
this.doc.Activate();
this.doc.selection.SelectAll();
this.allText +=this.doc.selection.Text;
},
load : function (){ return this.allText }
}

var docs = {
documents : new Enumerator( editor.Documents ),
size : function(){ return this.documents.Count; },
hasNext : function(){ return !this.documents.atEnd(); },
next : function(){ doc= this.documents.item();this.documents.moveNext();return doc }
}

while( docs.hasNext() ){
loadText.setDoc( docs.next() );
loadText.add();
}

//新規Document
Window.Editor.NewFile();
doc = Editor.Documents.Item( Editor.Documents.Count );
doc.write( loadText.allText );