wyw5125521 发表于 2013-10-3 11:39:13

延时启动程序,GUI框架是弄好了。希望大手给我指点编写的思路

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("程序定时运行", 250, 222, 192, 124)
$timemin = GUICtrlCreateInput("20", 104, 48, 41, 21)
$DDlj = GUICtrlCreateInput("", 8, 88, 161, 21)
$DDButton = GUICtrlCreateButton("1路径", 184, 88, 57, 25)
$Label1 = GUICtrlCreateLabel("定时时间", 8, 16, 220, 25)
$timehour = GUICtrlCreateInput("00", 8, 48, 41, 21)
$Label2 = GUICtrlCreateLabel("小时", 72, 53, 28, 17)
$Label3 = GUICtrlCreateLabel("分钟", 152, 53, 36, 17)
$DKlj = GUICtrlCreateInput("", 8, 124, 161, 21)
$DKButton2 = GUICtrlCreateButton("2路径", 184, 124, 57, 25)
$start = GUICtrlCreateButton("开始", 0, 183, 103, 33)
$cancel = GUICtrlCreateButton("取消", 129, 183, 103, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
        Case $GUI_EVENT_CLOSE   
                        Exit
       
EndSwitch
WEnd

GUI写好了,我想定时运行两个自动安装的程序。时间自己设定,两个程序的路径自己设定。自动安装的我会编写。延时的部分看到论坛里面说会占用CPU什么的不知道用什么函数好。希望高手给知道一下

user3000 发表于 2013-10-3 11:45:10

回复 1# wyw5125521

一般用 AdlibRegister 搞个自定义函数来检测“定时”; 要求精确度不高的,可以半分钟或几分钟检测一次。这会占什么CPU呢?!

xms77 发表于 2013-10-4 22:34:27

循环加判断时间加sleep,不会对CPU产生大的影响,比如
While 1
        If @HOUR = "19" And @MIN = "00" And @SEC = "00" Then
                xxx
                xxxx
                xxxxx
                ExitLoop
        EndIf
        Sleep(100)
WEnd

wyw5125521 发表于 2013-10-6 14:52:38

本帖最后由 wyw5125521 于 2013-10-6 14:58 编辑

回复 3# xms77


    谢谢咯,我先照这个思路来看一下。后续我再把我自己编的放上来

wyw5125521 发表于 2013-10-6 14:53:25

回复 2# user3000


    谢谢,后续把我自己测试的放上来。
页: [1]
查看完整版本: 延时启动程序,GUI框架是弄好了。希望大手给我指点编写的思路