情報が集まってきたら整理する。
それまではこのページに書いていく。
var _DirectoryPath = WScript.ScriptFullName.replace(/[\\\/]([^\\\/]+)$/, '');
var _XMLDom = new ActiveXObject('Microsoft.XMLDOM');
_XMLDom.load("config.xml")
_XMLDom.async = false;
var _Nodes = _XMLDom.documentElement.childNodes;
for (var _Index = 0; _Index < _Nodes.length; _Index++) {
var _Node = _Nodes[_Index];
WScript.Echo(_Node.getAttribute('name'));
WScript.Echo(_Node.getAttribute('adspath'));
WScript.Echo(_Node.getAttribute('user'));
WScript.Echo(_Node.getAttribute('pass'));
WScript.Echo('');
WScript.Echo('');
}
_XMLDom = null;
<?xml version="1.0" encoding="Shift_JIS"?>
<config>
<domain name="TopDomain" adspath="LDAP://DC01.codereign.org/DC=codereign,DC=org" user="user0001" pass="TopDomainPassword" />
<domain name="SubDomain" adspath="LDAP://DC02.sub.codereign.org/DC=sub,DC=codereign,DC=org" user="user0002" pass="SubDomainPassword" />
</config>
/// ---------------------------------------------------------------------------
/// <summary>Microsoft Office ファイルを読取専用で開くスクリプト</summary>
/// <remarks>対応済みアプリケーション:Word, Excel, MSProject, Visio, PowerPoint</remarks>
/// <author>Reign</author>
/// <homepage href="http://www.codereign.org/">CodeReign</homepage>
/// ---------------------------------------------------------------------------
if (WScript.Arguments.length == 0) {
WScript.Echo('開きたいファイルをドラック&ドロップしてください。');
WScript.Quit();
}
var _Word = null;
var _Excel = null;
var _Project = null;
var _Visio = null;
var _PowerPoint = null;
for (var _Index = 0; _Index < WScript.Arguments.length; _Index++) {
var _FilePath = WScript.Arguments(_Index);
var _Extension = _FilePath.replace(/.*\./, '');
if (_Extension.toLowerCase() == 'doc') {
if (_Word == null) _Word = new ActiveXObject('Word.Application');
_Word.Visible = true;
_Word.Documents.Open(_FilePath, null, true);
} else if (_Extension.toLowerCase() == 'xls') {
if (_Excel == null) _Excel = new ActiveXObject('Excel.Application');
_Excel.Visible = true;
_Excel.Workbooks.Open(_FilePath, null, true);
} else if (_Extension.toLowerCase() == 'mpp') {
if (_Project == null) _Project = new ActiveXObject('MSProject.Application');
_Project.Visible = true;
_Project.FileOpen(_FilePath, true);
} else if (_Extension.toLowerCase() == 'vsd') {
if (_Visio == null) _Visio = new ActiveXObject('Visio.Application');
_Visio.Visible = true;
_Visio.Documents.OpenEx(_FilePath, 2);
} else if (_Extension.toLowerCase() == 'ppt') {
if (_PowerPoint == null) _PowerPoint = new ActiveXObject('PowerPoint.Application');
_PowerPoint.Visible = true;
_PowerPoint.Presentations.Open(_FilePath, -1);
}
}/// ---------------------------------------------------------------------------
/// <summary>新しいExcel Applicationでブックを開くスクリプト</summary>
/// <remarks></remarks>
/// <author>Reign</author>
/// <homepage href="http://www.codereign.org/">CodeReign</homepage>
/// ---------------------------------------------------------------------------
if (WScript.Arguments.length == 0) {
WScript.Echo('開きたいファイルをドラック&ドロップしてください。');
WScript.Quit();
}
var _Excel = new ActiveXObject('Excel.Application');
for (var _Index = 0; _Index < WScript.Arguments.length; _Index++) {
var _FilePath = WScript.Arguments(_Index);
var _Extension = _FilePath.replace(/.*\./, '');
_Excel.Visible = true;
_Excel.Workbooks.Open(_FilePath, null, false);
}