forked from maestrith/AHK-Studio
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Plugins.ahk
33 lines (33 loc) · 964 Bytes
/
Plugins.ahk
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
test_plugin(){
save(),Exit(1,1)
return
}
plugins(){
plugins:
if !FileExist("plugins")
FileCreateDir,Plugins
pin:=menus.sn("//*[@clean='Plugin']/descendant::menu")
while,pp:=pin.item[A_Index-1],ea:=xml.ea(pp)
if !FileExist(ea.plugin)
pp.ParentNode.RemoveChild(pp)
if !menus.sn("//*[@clean='Plugin']/descendant::menu").length
rem:=menus.ssn("//*[@clean='Plugin']"),rem.ParentNode.RemoveChild(rem)
Loop,plugins\*.ahk
{
if !plugin:=menus.ssn("//menu[@clean='Plugin']")
plugin:=menus.Add({path:"menu",att:{clean:"Plugin",name:"P&lugin"},dup:1})
FileRead,plg,%A_LoopFileFullPath%
pos:=1
while,pos:=RegExMatch(plg,"Oi)\;menu\s*(.*)",found,pos){
item:=StrSplit(found.1,",")
if !ssn(plugin,"menu[@name='" item.1 "']")
menus.under(plugin,"menu",{name:item.1,clean:clean(item.1),plugin:A_LoopFileFullPath,option:item.2})
pos:=found.Pos(1)+1
}
}
SetTimer,refreshmenu,-300
return
refreshmenu:
Gui,1:Menu,% Menu("main")
return
}