楚留香-控制脚本运行

时间:2022-09-08 14:13:09
  1 Global default_config_path , my_config_path
  2 default_config_path = "C:Users\song\Desktop\tool\clx\Profiles\default.ini"
  3 my_config_path = "C:Users\song\Desktop\tool\clx\Profiles\config\"
  4 
  5 Sub config_file(b) //b=0登剑阁配置 b=1零点配置 b=2凌晨五点配置 b=3晚上五点配置
  6 
  7 Call file_del()    
  8 
  9 If b = 0 then //登剑阁配置 二、四 20:45执行    
 10 '复制配置参数文件 
 11 Call Plugin.File.CopyFile(my_config_path & "3_Change\default.ini", default_config_path)    
 12 
 13 ElseIf b = 1 then    //半夜十二点配置 每天都执行    
 14 Call Plugin.File.CopyFile(my_config_path & "4_Midnight\default.ini", default_config_path)
 15 
 16 Elseif b = 2 then //凌晨五点配置 每天都执行
 17 Call Plugin.File.CopyFile(my_config_path & "5_dawn\default.ini", default_config_path)
 18 
 19 Else //晚上五点配置 每天都执行
 20 Call Plugin.File.CopyFile(my_config_path & "2_Evening\default.ini", default_config_path)
 21 
 22 End if
 23 
 24 End Sub
 25 
 26 
 27 Sub file_del()
 28 
 29 IsFile = Plugin.File.IsFileExist(default_config_path)
 30 If IsFile Then 
 31 Call Plugin.File.DeleteFile(default_config_path)    
 32 End If
 33 
 34 End Sub
 35 
 36  
 37 
 38 
 39 Function judge_week()
 40 
 41 b = Weekday(now)//分离出现在时间里面星期天数1代表星期天,7代表星期六
 42 If b = 3 or b = 5 Then // 周二 周四 0 
 43 judge_week = 0    
 44 Else 
 45 judge_week = 1    
 46 End If    
 47 
 48 End Function
 49 
 50  
 51 
 52  
 53 
 54 Sub open_clsfz()
 55 
 56 Call RunApp("C:\Users\song\Desktop\tool\clx\clxfz.exe")
 57 Delay 20000
 58 
 59 End Sub
 60 
 61 
 62 Sub close_clyfz()
 63 
 64 Hwnd = Plugin.Window.Find( 0, "楚留香辅助") 
 65 Call Plugin.Window.Close(Hwnd) 
 66 
 67 End Sub
 68 
 69  
 70 
 71 Sub begin_click()
 72 
 73 MoveTo 802, 729
 74 Delay 20000
 75 LeftClick 1
 76 Delay 20000
 77 End Sub
 78 
 79 
 80 Sub close_esyfoo()
 81 
 82 Call RunApp("C:\Users\song\Desktop\tool\clx\eyefoo-kill.bat")
 83 
 84 End Sub
 85 
 86  
 87 
 88 Sub close_pl()
 89 
 90 Hwnd = Plugin.Window.Find( 0, "按键精灵") 
 91 Call Plugin.Window.Close(Hwnd) 
 92 
 93 End Sub
 94 
 95 
 96 Sub log_txt()
 97 str = "successed: " & CStr(now)
 98 call Plugin.File.WriteFileEx( "C:\Users\song\Desktop\tool\clx\Profiles\log.txt", str)
 99 End sub
100 
101 Call close_esyfoo()
102 i = 2
103 j = 2
104 b = 0
105 my_hour = 0
106 my_min = 0
107 
108 While j=2
109 
110 While i = 2
111 
112 my_hour = Hour(Now)    
113 my_min = Minute(Now)
114 
115 If judge_week() = 0 and my_hour = 20 and my_min = 50 Then //周二 四 20:45
116 i = 1
117 b = 0 
118 elseIf my_hour = 00 and my_min = 10 then    //半夜0:10
119 i = 1
120 b = 1    
121 elseif my_hour = 5 and my_min = 10 then    //凌晨5:10
122 i = 1
123 b = 2    
124 ElseIf my_hour = 17 and my_min = 00 then //晚上5点 
125 i = 1
126 b = 3
127 End if
128 
129 Wend
130 
131 i = 2
132 Call close_clyfz()
133 Call config_file(b)
134 Call open_clsfz()
135 Call begin_click()
136 Call log_txt()
137 If b = 2 then j = 1
138 Wend
139 
140 Delay 1000
141 
142 call close_pl()