Skúšal som robiť nejakého bota pomocou webBrowser, ale nie je to ideálne, najradšej by som to mal iba ako nejaký request bez grafiky, aby som to mohol spraviť ako services.
Tú je sript, ktorý je volaný tlačidlom:
Kód: Vybrať všetko
function restart1()
{
var f = document.forms[0];
if(confirm(REBOOT.CONFIRM))
{
parent.location.href = "restartdone.asp";
subForm(f,'apply.cgi','reboot',"mtenrestart.asp");
}
}Kód: Vybrať všetko
/* crate a apply string and use it to submit the settings
* f1 : name of form
* a : action
* d : service command(CMD)
* g : goto the url after submit
*/
function subForm(f1,a,d,g)
{
var msg=genForm('OUT',a,d,g);
//you can remove the ref to see the apply string before submit
/*DEMO*/
// if (!confirm(msg)) return;
/*END_DEMO*/
var newElem = document.createElement("div");
newElem.innerHTML = msg ;
f1.parentNode.appendChild(newElem);
f=document.OUT;
f.submit();
}
function genForm(n,a,d,g)
{
frmHead(n,a,d,g);
var sub=0;
var tmp;
for (var i=0;i<CA.length;i++)
{
if (CA[i].v!=CA[i].o)
{
tmp = CA[i].v + "";
if (tmp.indexOf("&")>=0) {
tmp = tmp.replace(/&/g,"&");
}
frmAdd("SET"+sub,String(CA[i].i)+"="+tmp);
sub++;
}
}
if (frmExtraElm.length)
OUTF+=frmExtraElm;
frmExtraElm=''; //reset
frmEnd();
return OUTF;
}
function frmHead(na,to,cmd,go)
{
OUTF="<FORM name="+na+" action="+to+" method=POST>\n"+
"<INPUT type=hidden name=CMD value="+cmd+">\n"+
"<INPUT type=hidden name=GO value="+go+">\n";
}