-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.aardio
180 lines (161 loc) · 6.59 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
//RUNAS//
import fsys.lnk
import win.messageFilter
import win.ui
import win.ui.tooltip
import win.util.tray
/*DSG{{*/
mainForm = win.form(cls="FEXC_FORM";text="Filename Exchanger";right=362;bottom=242;acceptfiles=1;border="thin";exmode="toolwindow";max=false;min=false;mode="popup";sysmenu=false;title=false;topmost=1)
mainForm.add(
button_start={cls="button";text="启动 | 啓動";left=118;top=183;right=245;bottom=227;default=1;font=LOGFONT(h=-19;name='微软雅黑');z=3};
edit_path1={cls="edit";left=11;top=59;right=351;bottom=99;edge=1;z=2};
edit_path2={cls="edit";left=11;top=126;right=351;bottom=166;edge=1;z=6};
static_bg={cls="static";left=0;top=0;right=363;bottom=33;bgcolor=14120960;z=1};
static_close={cls="static";text='\u26DD';left=329;top=2;right=356;bottom=29;align="center";center=1;color=16777215;font=LOGFONT(h=-26;name='微软雅黑');notify=1;transparent=1;z=8};
static_menu={cls="static";text='\uD83D\uDEE0\uFE0F';left=256;top=2;right=283;bottom=29;align="center";bgcolor=0;center=1;color=16777215;font=LOGFONT(h=-20;name='微软雅黑');notify=1;transparent=1;z=10};
static_min={cls="static";text="-";left=292;top=2;right=319;bottom=29;align="center";center=1;color=16777215;font=LOGFONT(h=-30;name='微软雅黑');notify=1;transparent=1;z=7};
static_path1={cls="static";text="文件一";left=11;top=39;right=57;bottom=57;font=LOGFONT(name='微软雅黑');transparent=1;z=4};
static_path2={cls="static";text="文件二";left=11;top=106;right=57;bottom=124;font=LOGFONT(name='微软雅黑');transparent=1;z=5};
static_tip={cls="static";text='\u2753';left=222;top=2;right=249;bottom=29;align="center";center=1;color=255;font=LOGFONT(h=-22;name='微软雅黑');notify=1;transparent=1;z=11};
static_top={cls="static";text='\u2693';left=4;top=2;right=31;bottom=29;align="center";center=1;color=65535;font=LOGFONT(h=-24;name='微软雅黑');notify=1;transparent=1;z=9}
)
/*}}*/
win.messageFilter.change(mainForm.hwnd,1/*_MSGFLT_ADD*/,0x4A/*_WM_COPYDATA*/,0x233/*_WM_DROPFILES*/,0x0049/*_WM_COPYGLOBALDATA*/ )
//io.open()
rename_dll := raw.loadDll($"name_exchanger_rs.dll",,"cdecl")
mainForm.static_tip.oncommand = function(id,event){
win.msgbox("拖入文件即可使用,软件自动常驻任务栏,悬停鼠标于右上角图标
可获得提示。
点击🛠️后将添加“右键菜单-发送到”,支持不打开直接使用。
如果右键菜单失效,请右键点击🛠。
右下角⚓/🔱可设置置顶与否。
拖入文件即可使用,軟體自動保持常駐,懸停鼠標於按鈕上可獲得提
示。
點擊🛠後可新增功能“右鍵選單-傳送到”,支持直接托拽文件使用。
如果右鍵選單失效,請右鍵點擊🛠。
右下方⚓/🔱為置頂開關。","Warning",,mainForm.hwnd)
}
argv_len_judge = table.len(_ARGV)
if(argv_len_judge == 0){
if(io.exist(io.joinpath(io.getSpecial(0x1a/*_CSIDL_APPDATA*/),"Microsoft\Windows\SendTo\name_exchanger.lnk"))){
lnk_exist = true
}else{
lnk_exist = false
}
if(io.splitpath(io._exefile).ext != ".exe"){
io.rename(io._exepath,io._exedir + io.splitpath(io._exepath).name + ".exe")
mainForm.static_tip.oncommand()
}
mainForm.show()
}elseif(argv_len_judge == 2){
//io.open()
result = rename_dll.exchange(_ARGV[1],_ARGV[2])
//io.print(result)
mainForm.close()
}else{
win.msgbox("Error for file error. Please Retry.","Error",,,1000)
mainForm.close()
}
var tooltipCtrl = win.ui.tooltip(mainForm)
var tip_table = {
"static_tip" = '答疑\n\n關於';
"static_menu" = '单击以创建右键菜单-“发送到”选项\n右键点击以删除原快捷方式\n\n新增至右鍵選單-“傳送到”選項\n點擊右鍵取消';
"static_top" = '置顶与否\n\n置頂開關';
"static_min" = '最小化';
"static_close" = '关闭\n\n關閉';
}
tooltipCtrl.add(tip_table)
mainForm.tray = win.util.tray(mainForm)
mainForm.tray.tip = '左键显示/隐藏|||右键退出\n左鍵顯示/隱藏|||右鍵退出'
mainForm.onDropFiles = function(files){
select(tonumber(table.len(files))) {
case 1{
if(mainForm.edit_path1.text == ""){
mainForm.edit_path1.text = files[1]
}elseif(mainForm.edit_path2.text == ""){
mainForm.edit_path2.text = files[1]
}else{
mainForm.edit_path1.text = files[1]
mainForm.edit_path2.text = ""
}
}
case 2{
mainForm.edit_path1.text = files[1]
mainForm.edit_path2.text = files[2]
}
else{
win.msgbox("Error for file error. Please Retry.","Error",,mainForm.hwnd,500)
}
}
}
mainForm.button_start.oncommand = function(id,event){
result = rename_dll.exchange(mainForm.edit_path1.text,mainForm.edit_path2.text)
//io.print(result)
if(result == 0){
mainForm.edit_path1.text = ""
mainForm.edit_path2.text = ""
}elseif(result == 1){
win.msgbox("No Exist","Error",,mainForm.hwnd,2000)
}elseif(result == 2){
win.msgbox("Permission Denied","Error",,mainForm.hwnd,2000)
}elseif(result == 3){
win.msgbox("New File Already Exists","Error",,mainForm.hwnd,2000)
}else {
win.msgbox("UNKNOWN ERROR","Error",,mainForm.hwnd,2000)
}
}
mainForm.onMouseDown = function(wParam,lParam){
mainForm.hitCaption()
}
mainForm.static_close.oncommand = function(id,event){
mainForm.close()
}
mainForm.static_top.oncommand = function(id,event){
if(mainForm.static_top.text == "🔱"){
win.setTopmost(mainForm.hwnd)
mainForm.static_top.text = "⚓"
}else{
win.setTopmost(mainForm.hwnd,false)
mainForm.static_top.text = "🔱"
}
}
mainForm.static_min.oncommand = function(id,event){
mainForm.show(false)
}
mainForm.onTrayMessage = {
[0x202/*_WM_LBUTTONUP*/] = function(wParam){
if(win.isVisible(mainForm.hwnd)){
mainForm.show(false)
}else{
mainForm.show(true)
}
}
[0x205/*_WM_RBUTTONUP*/] = function(wParam){
mainForm.close()
}
}
creat_lnk = function(judge_bool){
if(judge_bool){
io.remove(io.joinpath(io.getSpecial(0x1a/*_CSIDL_APPDATA*/),"Microsoft\Windows\SendTo\name_exchanger.lnk"))
win.msgbox("Removed","Tips",,mainForm.hwnd,1000)
}else{
var send_to_lnk = fsys.lnk()
send_to_lnk.description = "An lnk to filename exchange exe"
send_to_lnk.path = io._exepath
send_to_lnk.setIcon(io._exepath,0)
var temp_pth = io.joinpath(io.getSpecial(0x1a/*_CSIDL_APPDATA*/),"Microsoft\Windows\SendTo\")
send_to_lnk.save(temp_pth,"name_exchanger.lnk")
win.msgbox("Rebuild","Tips",,mainForm.hwnd,1500)
}
}
mainForm.static_menu.wndproc = function(hwnd,message,wParam,lParam){
select(message){
case 0x202/*_WM_LBUTTONUP*/{
creat_lnk(false)
}
case 0x205/*_WM_RBUTTONUP*/{
creat_lnk(true)
}
}
}
return win.loopMessage()