Iteration

www.altova.com このトピックを印刷 前のページ 1つ上のレベル 次のページ

ホーム >  プログラマーの レファレンス > Application API > Overview > Programming Languages > JScript >

Iteration

The JScript listing below shows how to iterate through the open documents. It is assumed that you have already started the application and opened some documents as shown in the previous sections.

 

// go through all open documents using a JScript Enumerator
for (var iterDocs = new Enumerator(objStyleVision.Documents); !iterDocs.atEnd(); iterDocs.moveNext())
{
  objName = iterDocs.item().Name;
  WScript.Echo("Document name: " + objName);
}
 
// go through all open documents using index-based access to the document collection
for (i = objStyleVision.Documents.Count; i > 0; i--)
  objStyleVision.Documents.Item(i).Close();

 

The JScript code listed above is available in the sample file DocumentAccess.js (see Example Files).


(C) 2019 Altova GmbH