HTA windows jscript
Пінг пк в мережі
налаштуйте в текстовому редакторові в 31 строці
назви пк
var names = ["PC7777HEAD0","PC7777IT4","PC7777IT1","PC7777OPER0","PC7777OPER1","PC7777OPER2","PC7777OPER3","PC7777OPER4","PC7777OPER5","PC7777OPER6","PC7777OPER7","PC7777OPER8","PC7777OPER9","PC7777REPACC1","PC7777REPACC2","PC7777REPACC3"];
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>ПК які зараз працюють</title>
<hta:application id="ohta" applicationname="ping1" border="thick"
borderstyle="normal" caption="yes"
icon="notepad.exe" maximizebutton="yes" minimizebutton="yes" showintaskbar="yes" singleinstance="yes" sysmenu="yes"
version="1.0" windowstate="normal"></hta:application>
<style type="text/css">
.yes {color:green;}
.no {color:#788;}
body {width:100%;height:100%;margin:0;padding:0;}
#btnSave {position: absolute;right:0px;bottom:0px;width:25px;}
table {
/*width: 95%; */
border-collapse: collapse;
}
td { border: 1px solid #999; padding: 0; text-align: right; }
th,caption { border: 1px solid #999; padding: 0; /*text-align: right;*/}
</style>
<script type="text/javascript">
var names = ["PC7777HEAD0","PC7777IT4","PC7777IT1","PC7777OPER0","PC7777OPER1","PC7777OPER2","PC7777OPER3","PC7777OPER4","PC7777OPER5","PC7777OPER6","PC7777OPER7","PC7777OPER8","PC7777OPER9","PC7777REPACC1","PC7777REPACC2","PC7777REPACC3"];
function Ping(host)
{
var wmi = GetObject("Winmgmts:"); // "Select StatusCode from Win32_PingStatus Where Address='" + host + "'"
var eStatus = new Enumerator(wmi.ExecQuery("Select * from Win32_PingStatus Where Address='" + host + "'"));
var s="";
var a;
//for (eStatus;!eStatus.atEnd;eStatus.moveNext())
//{
if (eStatus.item().StatusCode == 0)
return eStatus.item().ProtocolAddress;// new Array() s += eStatus.item().Address + "..."+ eStatus.item().StatusCode + " " +eStatus.item().ProtocolAddress;
else
return "";
//}
//eStatus.item().Address
//eStatus.item().StatusCode == 0;
//return s
}
function Main()
{
var i,s="",row="<tr>",d=new Date(),table="<table><caption>ПК які зараз("+ d.toLocaleTimeString() +")працюють</caption><tr><th>N</th><th>Name</th><th>Ip</th></tr>";
var ip = "", count=0;
for (i=0;i<names.length;i++)
{
ip = Ping(names[i]);
if(ip != "")
{
s+= "" + count+ "\t"+names[i] +"\t" +ip +"\r\n";
row+="<td>"+ ++count +"</td><td class='yes'>"+names[i]+ "</td><td class='yes'>" + ip + "</td></tr>";
}
else
{
row+="<td> </td><td class='no'>"+names[i]+ "</td><td class='no'>" + ip + "</td></tr>";
}
}
table+= row+"</table>";
document.all.divresult.innerHTML = table;
document.title = "ПК які зараз("+ d.toLocaleTimeString() +")працюють";
window.clipboardData.setData("Text","N\tNAME\tIP"+s);
}
function init()
{
window.resizeTo(320,500);
Main();
}
window.onload = init;
</script></head><body><div id="divresult">..Чекаємо !.........</div>
<button id="btnSave" onclick="Main()">→</button>
</html>
Post's attachmentsPing.7z 1.47 kb, 385 downloads since 2015-02-23