准备两个文件 ahk.csv和test.ahk——
ahk.csv如下,存放 方法+热键+功能。第三行意思是键盘输入//bin就会打开回收站
Run,#c,control
Send,![,「
RunHot,:*X://bin,::{645ff040-5081-101b-9f08-00aa002f954e}
test.ahk如下,读取csv并且使用HotKey等绑定
ahkdatafile = ahk.csv
ArrayHot := {}
If FileExist(ahkdatafile)
{
Loop, Read, %ahkdatafile%
{
funcArray := StrSplit(A_LoopReadLine,",")
if(funcArray.Length()<3)
continue
f0:=funcArray[1]
if (f0 == "Send")
{
ArrayHot[funcArray[2]]:=funcArray[3]
Hotkey, % funcArray[2], LabelSend
}
else if (f0 == "Run")
{
ArrayHot[funcArray[2]]:=funcArray[3]
Hotkey, % funcArray[2], LabelRun
}
else if (f0 == "RunHot")
{
ArrayHot[funcArray[2]]:=funcArray[3]
Hotstring(funcArray[2], "LabelRun")
}
}
}
LabelSend:
xpath := ArrayHot[A_ThisHotkey]
send % xpath
return
LabelRun:
xpath := ArrayHot[A_ThisHotkey]
run % xpath
return