-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.aardio
162 lines (155 loc) · 6.35 KB
/
main.aardio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import win.ui
import thread.table
import win.util.tray
import win.animate
/*DSG{{*/
mainForm = win.form(cls="TIME_TIP_FORM";text="时钟";left=0;top=100;right=232;bottom=147;image=$"\bg.png";bgcolor=4934475;border="none";exmode="toolwindow";max=false;min=false;sysmenu=false;topmost=1)
mainForm.add(
dot1={cls="static";text=":";left=64;top=0;right=83;bottom=47;align="center";center=1;clip=1;color=65535;db=1;dl=1;dt=1;font=LOGFONT(h=-48;name='微软雅黑');transparent=1;z=3};
dot2={cls="static";text=":";left=149;top=0;right=168;bottom=47;align="center";center=1;color=65535;db=1;dl=1;dr=1;dt=1;font=LOGFONT(h=-48;name='微软雅黑');transparent=1;z=4};
hotkey={cls="hotkey";left=199;top=27;right=232;bottom=47;edge=1;hide=1;z=6};
hour={cls="static";left=0;top=0;right=63;bottom=47;align="center";center=1;clip=1;color=16777215;db=1;dl=1;dt=1;font=LOGFONT(h=-48;name='微软雅黑');transparent=1;z=1};
min={cls="static";left=85;top=0;right=148;bottom=47;align="center";center=1;color=16777215;db=1;dl=1;dt=1;font=LOGFONT(h=-48;name='微软雅黑');transparent=1;z=2};
sec={cls="static";left=169;top=0;right=232;bottom=47;align="center";center=1;color=16777215;db=1;dr=1;dt=1;font=LOGFONT(h=-48;name='微软雅黑');transparent=1;z=5}
)
/*}}*/
if(!io.exist(io._exedir + "time_config.ini")){
string.save(io._exedir + "time_config.ini",$"\res\time_config.ini")
raw.execute("notepad.exe",io._exedir + "time_config.ini")
mainForm.close()
}
//io.open()
mainForm.tray = win.util.tray(mainForm)
var app_window = win.animate.slide(mainForm)
var time_list = thread.table("v_share_list",true)
thread.var("sleep_time",3)
thread.var("sleep_time_use",0)
thread.set("EFF958B55FC946A48E089063D2EC7426",true)
thread.invoke(
function(mainForm){
import win.ui
import thread.table
time_list = thread.table("v_share_list")
var temp = 1
var hotkey_list = {0,0}
for i in io.lines(io.open(io._exedir + "time_config.ini","r")){
if(string.left(i,1,true) == "&"){
time_list.set(tostring(temp),string.right(i,-2,true))
temp = temp + 1
}elseif(string.left(i,1,true) == "@"){
hotkey_list[1] = string.right(i,-2,true)
}elseif(string.left(i,1,true) == "%"){
hotkey_list[2] = string.right(i,-2,true) + 64
}elseif(string.left(i,1,true) == "+"){
thread.var("sleep_time").set(string.right(i,-2,true)*1)
thread.var("sleep_time_use").set(string.right(i,-2,true)*1)
}
}
thread.set("EFF958B55FC946A48E089063D2EC7426",false)
if (hotkey_list[2] != 0){
mainForm.hotkey.value = hotkey_list
if((mainForm.hotkey.value[2] != 0) and (mainForm.hotkey.value[2] != null)){
mainForm.hotkey.value = hotkey_list
}
}
},mainForm
)
//io.open()
thread.invoke(
function(mainForm,time_str){
import win
import thread.table
import win.animate
time_now = time()
app_window = win.animate.slide(mainForm)
while(thread.get("EFF958B55FC946A48E089063D2EC7426") and (sleep(100))){
if(thread.var("sleep_time").get() == thread.var("sleep_time_use").get()){
thread.var("sleep_time_use").set(0)
}
thread.set("EFF958B55FC946A48E089063D2EC7426",null)
}
var flag = false
while(sleep(400)){
time_now = time()
//io.print(time_now)
//io.print(thread.var("sleep_time_use").get(),type(thread.var("sleep_time_use").get()))
//if(tonumber(time_now.minute)%10 == 0 and tonumber(time_now.second) == 0){
// time_now = time()
//}elseif(tonumber(time_now.minute) == 0 and tonumber(time_now.second) == 0){
// time_now = time()
//}
if(tonumber(time_now.hour) < 10){
mainForm.hour.text = "0" + tostring(time_now.hour)
}else{
mainForm.hour.text = tostring(time_now.hour)}
if(tonumber(time_now.minute) < 10){
mainForm.min.text = "0" + tostring(time_now.minute)
}else{
mainForm.min.text = tostring(time_now.minute)}
if(tonumber(time_now.second) < 10){
mainForm.sec.text = "0" + tostring(time_now.second)
}else{
mainForm.sec.text = tostring(time_now.second)
}
time_str = thread.table("v_share_list").tostring()
var find_1,find_2 = string.indexOf(time_str,tostring(time_now,"%H%M%S"))
//io.print((find_1 != null) and (thread.var("sleep_time_use").get() == 0))
//io.print((flag == true) and (thread.var("sleep_time_use").get() < thread.var("sleep_time").get()))
//io.print((flag == true) and (thread.var("sleep_time_use").get() == thread.var("sleep_time").get()))
//io.print()
if((find_1 != null) and (thread.var("sleep_time_use").get() == 0)){
flag = true
mainForm.hour.color = 65535
mainForm.min.color = 65535
mainForm.sec.color = 65535
mainForm.redraw()
app_window = win.animate.slide(mainForm)
app_window.show(1000,0x1/*水平自左向右*/)
thread.var("sleep_time_use").set(thread.var("sleep_time_use").get() + 1)
}elseif((flag == true) and (thread.var("sleep_time_use").get() < thread.var("sleep_time").get())){
thread.var("sleep_time_use").set(thread.var("sleep_time_use").get() + 1)
}elseif((flag == true) and (thread.var("sleep_time_use").get() == thread.var("sleep_time").get())){
thread.var("sleep_time_use").set(0)
flag = false
app_window.hide(500,0x2/*水平自右向左*/)
mainForm.hour.color = 16777215
mainForm.min.color = 16777215
mainForm.sec.color = 16777215
}
}
},mainForm,time_list
)
mainForm.onTrayMessage = {
[0x205/*_WM_RBUTTONUP*/ ] = function(wParam){
mainForm.close()};
[0x202/*_WM_LBUTTONUP*/] = function(wParam){
mainForm.reghotkey(
function(id,mod,vk){
app_window.show(1000,0x1/*水平自左向右*/)
win.delay(thread.var("sleep_time").get() * 1000)
app_window.hide(500,0x2/*水平自右向左*/)
},
mainForm.hotkey.gethotkey()
)
app_window.show(1000,0x1/*水平自左向右*/)
win.delay(thread.var("sleep_time").get() * 1000)
app_window.hide(500,0x2/*水平自右向左*/)
};
[0x203/*_WM_LBUTTONDBLCLK*/] = function(wParam){};
[0x404/*_PARAM_DESTROY*/] = function(wParam){};
[0x405/*_PARAM_CLICKED*/] = function(wParam){};}
mainForm.onMouseDown = function(wParam,lParam){
mainForm.hitCaption()
}
mainForm.wndproc = function(hwnd,message,wParam,lParam){
select(message){
case 0x206/*_WM_RBUTTONDBLCLK*/{
mainForm.close()
}
case 0x203/*_WM_LBUTTONDBLCLK*/{
import win.property
win.msgbox(win.property.get(mainForm.hwnd,"Opacity"))
}
}
}
return win.loopMessage()