找回密码
 加入
搜索
查看: 2301|回复: 4

[AU3基础] 如果我想按北京时间来切换复制文件?

  [复制链接]
发表于 2010-3-24 08:16:25 | 显示全部楼层 |阅读模式
以下代码就是按时间轮流切换,按一定时间把js1~js3文件夹里面的duote.js复制到yanqiao2010目录下。

【代码一】
hotkeyset ("{esc}","esc")
func esc()
exit
endfunc
while 1
filecopy ("D:\yanqiao2010\js\js1\duote.js","D:\yanqiao2010\duote.js",1)
sleep (5000)
filecopy ("D:\yanqiao2010\js\js2\duote.js","D:\yanqiao2010\duote.js",1)
sleep (5000)
filecopy ("D:\yanqiao2010\js\js3\duote.js","D:\yanqiao2010\duote.js",1)
sleep (5000)
filecopy ("D:\yanqiao2010\js\js4\duote.js","D:\yanqiao2010\duote.js",1)
sleep (5000)
wend



如果我想按北京时间来切换怎么换?具体是这样:

每天晚上21:01~第二天早上8:00都只运行【代码二】中的代码

每天早上8:01~晚上21:00都只运行【代码一】中的代码

这个怎么来整合在一起呢?






【代码二】
hotkeyset ("{esc}","esc")
func esc()
exit
endfunc
while 1
filecopy ("D:\yanqiao2010\js\js1\duote.js","D:\yanqiao2010\duote.js",1)
sleep (5000)
filecopy ("D:\yanqiao2010\js\js2\duote.js","D:\yanqiao2010\duote.js",1)
sleep (5000)
wend
发表于 2010-3-24 14:36:06 | 显示全部楼层
hotkeyset ("{esc}","esc")
func esc()
exit
endfunc

while 1
        If   @HOUR> 8 And @HOUR <21 Then 
filecopy ("D:\yanqiao2010\js\js1\duote.js","D:\yanqiao2010\duote.js",1)
sleep (5000)
filecopy ("D:\yanqiao2010\js\js2\duote.js","D:\yanqiao2010\duote.js",1)
sleep (5000)
filecopy ("D:\yanqiao2010\js\js3\duote.js","D:\yanqiao2010\duote.js",1)
sleep (5000)
filecopy ("D:\yanqiao2010\js\js4\duote.js","D:\yanqiao2010\duote.js",1)
sleep (5000)
Else
filecopy ("D:\yanqiao2010\js\js1\duote.js","D:\yanqiao2010\duote.js",1)
sleep (5000)
filecopy ("D:\yanqiao2010\js\js2\duote.js","D:\yanqiao2010\duote.js",1)
sleep (5000)
EndIf
wend

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

发表于 2010-3-24 14:56:51 | 显示全部楼层
谢谢分享!!
发表于 2010-3-24 15:31:09 | 显示全部楼层
精简下
HotKeySet("{esc}", "esc")
While 1
        If @HOUR > 8 And @HOUR <= 21 Then $x = 4
        If @HOUR <= 8 And @HOUR > 21 Then $x = 2
        For $i = 1 To $x
                FileCopy("D:\yanqiao2010\js\js" & $i & "\duote.js", "D:\yanqiao2010\duote.js", 1)
                Sleep(5000)
        Next
WEnd
Func esc()
        Exit
EndFunc   ;==>esc
发表于 2010-3-24 15:59:11 | 显示全部楼层
用系统自带的 任务计划 最好不过了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-20 19:15 , Processed in 0.086535 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表