定时关机dos

import win.ui;
import process.popen; //使用process.popen(cmd)不会闪黑窗
/*DSG{{*/
mainForm = win.form(text="定时关机程序";right=582;bottom=206;mode="popup")
mainForm.add(
button={cls="button";text="执行";left=42;top=154;right=211;bottom=187;z=1};
button2={cls="button";text="取消";left=310;top=158;right=481;bottom=187;z=6};
edit={cls="edit";text="0";left=164;top=62;right=235;bottom=93;align="center";edge=1;multiline=1;z=5};
edit2={cls="edit";text="0";left=294;top=60;right=369;bottom=93;align="center";edge=1;z=8};
groupbox={cls="groupbox";text="定时关机";left=25;top=10;right=555;bottom=142;edge=1;z=2};
static={cls="static";text="Static";left=74;top=78;right=164;bottom=79;transparent=1;z=3};
static2={cls="static";text="倒计时";left=69;top=64;right=171;bottom=92;font=LOGFONT(h=-18);transparent=1;z=4};
static3={cls="static";text="分";left=255;top=68;right=312;bottom=88;font=LOGFONT(h=-18);transparent=1;z=7};
static4={cls="static";text="秒";left=398;top=68;right=433;bottom=89;font=LOGFONT(h=-18);transparent=1;z=9}
)
/*}}*/
 
mainForm.button.oncommand = function(id,event){
    var time=mainForm.edit.text*60+mainForm.edit2.text ;
    var cmdc ="shutdown -s"+" -t "+ time ;
    //mainForm.msgbox(cmdc)
    process.popen(cmdc);
}
 
mainForm.edit.oncommand = function(id,event){
     
}
 
mainForm.button2.oncommand = function(id,event){
      
    process.popen("shutdown -a");
    mainForm.msgbox("计划已取消")
     
}
 
mainForm.edit2.oncommand = function(id,event){
     
}
 
mainForm.show();
return win.loopMessage();

  

猜你喜欢

转载自www.cnblogs.com/yaoyue68/p/10486499.html