You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
578 lines
14 KiB
578 lines
14 KiB
|
|
<HTML>
|
|
<HEAD>
|
|
|
|
<TITLE>Remote Test Page</TITLE>
|
|
|
|
<STYLE>
|
|
|
|
BLOCKQUOTE { margin-top:0; padding-top:0; }
|
|
|
|
</STYLE>
|
|
|
|
<SCRIPT>
|
|
|
|
var aMachines =
|
|
[
|
|
"edsel01", "edsel02", "edsel03", "edsel04", "edsel05",
|
|
"edsel06", "edsel7", "edsel8", "edsel9", "edsel10",
|
|
"edsel11", "edsel12",
|
|
"windshield",
|
|
"EXHAUST",
|
|
"headlight",
|
|
"antenna",
|
|
"studebaker",
|
|
"hound-1",
|
|
"hound-2",
|
|
"upholstry",
|
|
"handbrake",
|
|
"headerpipe",
|
|
"glasspack",
|
|
"jackspc2",
|
|
"jackspc"
|
|
];
|
|
|
|
function ErrorCheck(fn)
|
|
{
|
|
try
|
|
{
|
|
eval(fn);
|
|
}
|
|
catch(ex)
|
|
{
|
|
var i;
|
|
var str = '';
|
|
for (i in ex)
|
|
{
|
|
if (typeof(ex[i]) == 'number')
|
|
{
|
|
var value = ex[i];
|
|
|
|
if (value < 0)
|
|
{
|
|
value = value + 0x100000000;
|
|
}
|
|
|
|
str += '\t' + i + ': ' + ex[i] + ' (' + value.toString(16) + ')\n';
|
|
}
|
|
else
|
|
{
|
|
str += '\t' + i + ': ' + ex[i] + '\n';
|
|
}
|
|
}
|
|
window.alert("an error occurred while executing '" + fn + "'\n" + str);
|
|
}
|
|
}
|
|
|
|
function Connect()
|
|
{
|
|
window.alert("Try 1");
|
|
var g_RemoteObj1 = new ActiveXObject('MTScript.Proxy', "JPORKKA1");
|
|
window.alert("Try 2");
|
|
var g_RemoteObj2 = new ActiveXObject('MTScript.Remote', "JPORKKA1");
|
|
window.alert("Try 3");
|
|
|
|
|
|
var str = '';
|
|
RemoteObj.Connect(machname.value);
|
|
str = 'Connected to machine ' + RemoteObj.Name + '.<BR>';
|
|
str += ' Platform = ' + RemoteObj.Platform + '<BR>';
|
|
str += ' OS = ' + RemoteObj.OS + '<BR>';
|
|
str += ' MajorVer = ' + RemoteObj.MajorVer + '<BR>';
|
|
str += ' MinorVer = ' + RemoteObj.MinorVer + '<BR>';
|
|
str += ' BuildNum = ' + RemoteObj.BuildNum + '<BR>';
|
|
str += ' PlatformIsNT = ' + RemoteObj.PlatformIsNT + '<BR>';
|
|
str += ' ServicePack = ' + RemoteObj.ServicePack + '<BR> ';
|
|
|
|
Output.innerHTML = str;
|
|
|
|
DumpData();
|
|
|
|
}
|
|
|
|
function Disconnect()
|
|
{
|
|
RemoteObj.Disconnect();
|
|
|
|
Output.innerText = '';
|
|
Pub.innerText = '';
|
|
}
|
|
|
|
function SetMode(modename)
|
|
{
|
|
cmd.value = 'setmode';
|
|
args.value = modename;
|
|
SendExec();
|
|
DumpData();
|
|
}
|
|
|
|
function Init()
|
|
{
|
|
cmd.value = 'setconfig';
|
|
// args.value = 'file://%ScriptPath%\\..\\docs\\config_template.xml';
|
|
args.value = 'file://%ScriptPath%\\config_template.xml';
|
|
SendExec();
|
|
|
|
cmd.value = 'setenv';
|
|
// args.value = 'file://%ScriptPath%\\..\\docs\\env_template.xml';
|
|
args.value = 'file://%ScriptPath%\\env_template.xml';
|
|
SendExec();
|
|
|
|
DumpData();
|
|
}
|
|
|
|
function SendExec()
|
|
{
|
|
var vRet = RemoteObj.Exec(cmd.value, args.value);
|
|
|
|
try
|
|
{
|
|
Output.insertAdjacentText('beforeEnd', 'Exec sent. Return value = "' + vRet + '"');
|
|
|
|
Output.insertAdjacentHTML('beforeEnd', '<BR> ');
|
|
}
|
|
catch(ex)
|
|
{
|
|
// Ignore errors
|
|
}
|
|
}
|
|
|
|
var g_strDump;
|
|
|
|
function DumpDataPrivate()
|
|
{
|
|
g_strDump = '';
|
|
|
|
try
|
|
{
|
|
var str = RemoteObj.Exec('getpublic', 'PrivateData');
|
|
var pd = eval(str);
|
|
DumpObject(pd, 77);
|
|
}
|
|
catch(ex)
|
|
{
|
|
debugger;
|
|
throw ex;
|
|
}
|
|
|
|
Pub.innerHTML = g_strDump;
|
|
}
|
|
|
|
function DumpData()
|
|
{
|
|
g_strDump = '';
|
|
|
|
try
|
|
{
|
|
var str = RemoteObj.Exec('getpublic', 'root');
|
|
var pd = eval(str);
|
|
DumpObject(pd, 77);
|
|
}
|
|
catch(ex)
|
|
{
|
|
debugger;
|
|
throw ex;
|
|
}
|
|
|
|
Pub.innerHTML = g_strDump;
|
|
}
|
|
|
|
function OutputDebugString(str)
|
|
{
|
|
Output.insertAdjacentText('beforeEnd', str);
|
|
Output.insertAdjacentHTML('beforeEnd', '<BR> ');
|
|
}
|
|
|
|
function ExitAllProc()
|
|
{
|
|
var m;
|
|
var vRet;
|
|
for( m in aMachines)
|
|
{
|
|
try
|
|
{
|
|
RemoteObj.Connect(aMachines[m]);
|
|
str = 'Connected to machine ' + RemoteObj.Name;
|
|
vRet = RemoteObj.Exec("exitprocess", 0);
|
|
OutputDebugString("Exit proc on " + aMachines[m] + " returned " + vRet);
|
|
RemoteObj.Disconnect();
|
|
}
|
|
catch(ex)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
|
|
function ConnectAllProc()
|
|
{
|
|
var m;
|
|
for( m in aMachines)
|
|
{
|
|
try
|
|
{
|
|
RemoteObj.Connect(aMachines[m]);
|
|
var str = RemoteObj.Exec('getpublic', 'nDataVersion');
|
|
str = RemoteObj.Name + " OK";
|
|
OutputDebugString(str);
|
|
RemoteObj.Disconnect();
|
|
}
|
|
catch(ex)
|
|
{
|
|
OutputDebugString(aMachines[m] + " " + ex.description);
|
|
}
|
|
}
|
|
}
|
|
|
|
function Browse()
|
|
{
|
|
var opt;
|
|
var strRootTag;
|
|
var strFilePattern = '*PublicData*.log';
|
|
var strTempDir;
|
|
|
|
FSObj = new ActiveXObject('Scripting.FileSystemObject');
|
|
strTempDir = FSObj.GetSpecialFolder(2).Path; // Temp Folder
|
|
|
|
|
|
comdlg.FileName = strFilePattern;
|
|
comdlg.DialogTitle = 'Select Log File';
|
|
comdlg.Flags = 524288 + // Use explorer format
|
|
4 + // Hide read-only checkbox
|
|
2048 + // Path must exist
|
|
4096; // File must exist
|
|
|
|
comdlg.Filter = 'LOG Files (*.log)|*PublicData*.log';
|
|
comdlg.InitDir = strTempDir;
|
|
comdlg.ShowOpen();
|
|
|
|
if (comdlg.FileName == strFilePattern)
|
|
return;
|
|
|
|
return comdlg.FileName;
|
|
}
|
|
|
|
function ViewPDLog()
|
|
{
|
|
try
|
|
{
|
|
var strFileName = Browse();
|
|
if (!strFileName)
|
|
return;
|
|
|
|
var FSObj = new ActiveXObject("Scripting.FileSystemObject");
|
|
var logfile = FSObj.OpenTextFile(strFileName, 1, false);
|
|
var strData = logfile.ReadAll();
|
|
logfile.Close();
|
|
|
|
var obj = eval(strData);
|
|
DumpObject(obj, 99);
|
|
Pub.innerHTML = g_strDump;
|
|
}
|
|
catch(ex)
|
|
{
|
|
Pub.innerHTML = '';
|
|
}
|
|
}
|
|
|
|
function DumpObject(obj, maxdepth)
|
|
{
|
|
var TreeResult = DumpObjectWorker(obj, maxdepth);
|
|
var str = UndumpTree(TreeResult);
|
|
g_strDump = str;
|
|
}
|
|
|
|
function UndumpTree(tree)
|
|
{
|
|
var str = '';
|
|
for(var index = 0; index < tree.length; ++index)
|
|
{
|
|
if (typeof(tree[index]) == 'object')
|
|
{
|
|
str += UndumpTree(tree[index]);
|
|
}
|
|
else
|
|
str += tree[index];
|
|
}
|
|
return str;
|
|
}
|
|
|
|
function DumpObjectWorker(obj, maxdepth)
|
|
{
|
|
var fHasChildren;
|
|
var j;
|
|
var i;
|
|
var result;
|
|
|
|
var tree = new Array();
|
|
var index = 0;
|
|
|
|
if (maxdepth == 0)
|
|
{
|
|
tree[index] = '<I>Maximum Depth reached</I><BR>';
|
|
return tree;
|
|
}
|
|
|
|
for (i in obj)
|
|
{
|
|
if (typeof(obj[i]) == 'object')
|
|
{
|
|
fHasChildren = false;
|
|
|
|
for (j in obj[i])
|
|
{
|
|
if (j != 'length')
|
|
{
|
|
fHasChildren = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!fHasChildren)
|
|
{
|
|
tree[index++] = '<STRONG>' + i + '</STRONG> (empty)<BR>';
|
|
}
|
|
else
|
|
{
|
|
tree[index++] = '<SPAN> <B onclick="toggle(this)">' + i + '</B><BR><DIV id=quote style="display:none;margin-left:3em">';
|
|
|
|
result = DumpObjectWorker(obj[i], maxdepth-1);
|
|
tree[index++] = result;
|
|
|
|
tree[index++] = '</DIV></SPAN>';
|
|
}
|
|
}
|
|
else if (typeof(obj[i]) == 'string')
|
|
{
|
|
tree[index++] = '' + i + ' = "' + obj[i] + '"<BR>';
|
|
}
|
|
else
|
|
{
|
|
tree[index++] = '' + i + ' = ' + obj[i] + '<BR>';
|
|
}
|
|
}
|
|
return tree;
|
|
}
|
|
function toggle(obj) { with (obj.parentElement.children("quote").style) { if (display=="none") display=""; else display="none"; }}
|
|
//======================================================================================================
|
|
/*
|
|
function DumpObject(obj, maxdepth)
|
|
{
|
|
var TreeResult = DumpObjectWorker(obj, maxdepth);
|
|
g_strDump = UndumpTree(TreeResult);
|
|
}
|
|
|
|
function UndumpTree(tree)
|
|
{
|
|
var str = '';
|
|
for(var index = 0; index < tree.length; ++index)
|
|
{
|
|
if (typeof(tree[index]) == 'object')
|
|
{
|
|
str += UndumpTree(tree[index]);
|
|
}
|
|
else
|
|
str += tree[index];
|
|
}
|
|
return str;
|
|
}
|
|
|
|
function DumpObjectWorker(obj, maxdepth)
|
|
{
|
|
var fHasChildren;
|
|
var j;
|
|
var i;
|
|
var result;
|
|
|
|
var tree = new Array();
|
|
var index = 0;
|
|
|
|
if (maxdepth == 0)
|
|
{
|
|
tree[index] = '<I>Maximum Depth reached</I><BR>';
|
|
return tree;
|
|
}
|
|
|
|
for (i in obj)
|
|
{
|
|
if (typeof(obj[i]) == 'object')
|
|
{
|
|
fHasChildren = false;
|
|
|
|
for (j in obj[i])
|
|
{
|
|
if (j == 'length')
|
|
{
|
|
fHasChildren = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!fHasChildren)
|
|
{
|
|
tree[index++] = '<STRONG>' + i + '</STRONG> (empty)<BR>';
|
|
}
|
|
else
|
|
{
|
|
tree[index++] = '<SPAN> <B onclick="toggle(this)">' + i + '</B><BR><DIV id=quote style="display:none;margin-left:3em">';
|
|
|
|
result = DumpObjectWorker(obj[i], maxdepth-1);
|
|
tree[index++] = result;
|
|
|
|
tree[index++] = '</DIV></SPAN>';
|
|
}
|
|
}
|
|
else if (typeof(obj[i]) == 'string')
|
|
{
|
|
tree[index++] = '' + i + ' = "' + obj[i] + '"<BR>';
|
|
}
|
|
else
|
|
{
|
|
tree[index++] = '' + i + ' = ' + obj[i] + '<BR>';
|
|
}
|
|
}
|
|
return tree;
|
|
}*/
|
|
/*function DumpObject(obj, maxdepth)
|
|
{
|
|
if (maxdepth == 0)
|
|
return;
|
|
|
|
for (i in obj)
|
|
{
|
|
if (typeof(obj[i]) == 'object')
|
|
{
|
|
g_strDump += '<B>' + i + '</B><BLOCKQUOTE>';
|
|
|
|
DumpObject(obj[i], maxdepth-1);
|
|
|
|
g_strDump += '</BLOCKQUOTE>';
|
|
}
|
|
else
|
|
{
|
|
g_strDump += i + ' = "' + obj[i] + '"<BR>';
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
|
|
</SCRIPT>
|
|
|
|
<SCRIPT for=RemoteObj event="OnScriptNotify(arg1, arg2)" language=JavaScript>
|
|
try
|
|
{
|
|
Notify.insertAdjacentHTML('beforeEnd', '<B>Notify(' + arg1 + ', ' + arg2 + ')</B><BR>');
|
|
if (arg1 == 'UpdatePublicData')
|
|
{
|
|
DumpData();
|
|
}
|
|
}
|
|
catch(ex)
|
|
{
|
|
// Ignore errors
|
|
}
|
|
</SCRIPT>
|
|
|
|
<SCRIPT for=RemoteObjWorker event="OnScriptNotify(arg1, arg2)" language=JavaScript>
|
|
try
|
|
{
|
|
}
|
|
catch(ex)
|
|
{
|
|
// Ignore errors
|
|
}
|
|
</SCRIPT>
|
|
|
|
</HEAD>
|
|
|
|
<BODY>
|
|
|
|
Machine (leave blank for local machine): <INPUT type=text id=machname>
|
|
<INPUT type=button value="Connect" onclick="ErrorCheck('Connect()')">
|
|
<INPUT type=button value="Disconnect" onclick="ErrorCheck('Disconnect()')">
|
|
<INPUT type=button value="Init" onclick="ErrorCheck('Init()')" style="width:5em">
|
|
<TABLE>
|
|
<TR>
|
|
<INPUT type=button value="SetMode master" onclick="ErrorCheck('SetMode(\'master\')')" style="width:8em">
|
|
<INPUT type=button value="SetMode slave" onclick="ErrorCheck('SetMode(\'slave\')')" style="width:8em">
|
|
<INPUT type=button value="SetMode test" onclick="ErrorCheck('SetMode(\'test\')')" style="width:8em">
|
|
<INPUT type=button value="SetMode idle" onclick="ErrorCheck('SetMode(\'idle\')')" style="width:8em">
|
|
</TABLE>
|
|
|
|
<P>
|
|
Command: <INPUT type=text id=cmd>
|
|
Args: <INPUT type=text id=args>
|
|
<INPUT type=button value="Send" onclick="ErrorCheck('SendExec()')">
|
|
|
|
<hr>
|
|
<TABLE width=100%>
|
|
<TR>
|
|
<TD valign=top ROWSPAN=2>
|
|
<INPUT type=button value="Clear Output" onclick="Output.innerHTML='';Notify.innerHTML='';">
|
|
<P>
|
|
<SPAN id=Output></SPAN>
|
|
</TD>
|
|
<TD valign=top>
|
|
<SPAN id=Notify></SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD valign=top>
|
|
<INPUT type=button value="Exit All Edsel" onclick="ErrorCheck('ExitAllProc()')">
|
|
<INPUT type=button value="Connect All Edsel" onclick="ErrorCheck('ConnectAllProc()')">
|
|
<INPUT type=button value="View PD Log" onclick="ErrorCheck('ViewPDLog()')">
|
|
<INPUT type=button value="Dump PublicData" onclick="ErrorCheck('DumpData()')">
|
|
<INPUT type=button value="Dump PrivateData" onclick="ErrorCheck('DumpDataPrivate()')">
|
|
<P>
|
|
<DIV id=Pub></DIV>
|
|
</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<OBJECT id=RemoteObj
|
|
CLASSID="clsid:854c3182-c854-4a77-b189-606859e4391b">
|
|
</OBJECT>
|
|
|
|
<OBJECT id=RemoteObjWorker
|
|
CLASSID="clsid:854c3182-c854-4a77-b189-606859e4391b">
|
|
</OBJECT>
|
|
|
|
<!-- License object which allows us to us the common dialog OCX -->
|
|
<object CLASSID="clsid:5220cb21-c88d-11cf-b347-00aa00a28331" VIEWASTEXT>
|
|
<param NAME="LPKPath" VALUE="comdlg.lpk">
|
|
</object>
|
|
|
|
<!-- The common dialog OCX -->
|
|
<object classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" codeBase="controls/comdlg32.ocx#version=6,0,84,18" id="comdlg" style="LEFT: 0px; TOP: 0px" VIEWASTEXT>
|
|
<param NAME="_ExtentX" VALUE="847">
|
|
<param NAME="_ExtentY" VALUE="847">
|
|
<param NAME="_Version" VALUE="393216">
|
|
<param NAME="CancelError" VALUE="0">
|
|
<param NAME="Color" VALUE="0">
|
|
<param NAME="Copies" VALUE="1">
|
|
<param NAME="DefaultExt" VALUE>
|
|
<param NAME="DialogTitle" VALUE>
|
|
<param NAME="FileName" VALUE>
|
|
<param NAME="Filter" VALUE>
|
|
<param NAME="FilterIndex" VALUE="0">
|
|
<param NAME="Flags" VALUE="0">
|
|
<param NAME="FontBold" VALUE="0">
|
|
<param NAME="FontItalic" VALUE="0">
|
|
<param NAME="FontName" VALUE>
|
|
<param NAME="FontSize" VALUE="8">
|
|
<param NAME="FontStrikeThru" VALUE="0">
|
|
<param NAME="FontUnderLine" VALUE="0">
|
|
<param NAME="FromPage" VALUE="0">
|
|
<param NAME="HelpCommand" VALUE="0">
|
|
<param NAME="HelpContext" VALUE="0">
|
|
<param NAME="HelpFile" VALUE>
|
|
<param NAME="HelpKey" VALUE>
|
|
<param NAME="InitDir" VALUE>
|
|
<param NAME="Max" VALUE="0">
|
|
<param NAME="Min" VALUE="0">
|
|
<param NAME="MaxFileSize" VALUE="260">
|
|
<param NAME="PrinterDefault" VALUE="1">
|
|
<param NAME="ToPage" VALUE="0">
|
|
<param NAME="Orientation" VALUE="1"></object>
|
|
|
|
</BODY>
|
|
</HTML>
|