说明:
自动启动脚本目录下,script文件夹中的ahk脚本,略过脚本名以”!”开始的
请将ahkinfo.exe、autohotkey.chm和脚本放在同一目录,便于使用
双击托盘图标打开管理工具,可查看脚本热键、历史等(小脚本一般隐藏图标,蓝蓝小雪的脚本管理不便于调试)
/*
Script Name: Script_Manager
Version: 0.1
Author: fuwt
AutoHotkey v2.0-a077-c2bb552
15 1月 2017 22:33:46
*/
#SingleInstance, force
SetTitleMatchMode, 2
DetectHiddenWindows, on
SetWorkingDir, %A_ScriptDir%
WM_COMMAND := 0x111
ID_EditScript := 65401
ID_ReloadScript := 65400
ID_PauseScript := 65403
ID_SuspendScript := 65404
ID_ExitScript := 65405
ID_ViewHistory := 65406
ID_ViewVariables := 65407
ID_ViewHotkeys := 65408
;Menu, Tray, Icon, Ico\rose.ico
Menu, Tray, Click, 2
Menu, Tray, NoStandard
Gui, +LastFound
Gui, Font, s11
Gui, Add, ListView, xm ym+10 w500 r20 HwndthisLV, 窗口句柄|脚本名称|脚本路径
Gui, Add, GroupBox, x+10 yp w100 h190, 查看
Gui, Add, Button, xp+10 yp+20 w80 r1 gOperateScript vID_EditScript, 编辑(&E)
Gui, Add, Button, xp y+15 w80 r1 gOperateScript vID_ViewHistory, 历史(&L)
Gui, Add, Button, xp y+15 w80 r1 gOperateScript vID_ViewVariables, 变量(&V)
Gui, Add, Button, xp y+15 w80 r1 gOperateScript vID_ViewHotkeys, 热键(&K)
Gui, Add, GroupBox, xp-10 y+40 w100 h190, 操作
Gui, Add, Button, xp+10 yp+20 w80 r1 gOperateScript vID_PauseScript, 暂停(&P)
Gui, Add, Button, xp y+15 w80 r1 gOperateScript vID_SuspendScript, 挂起(&S)
Gui, Add, Button, xp y+15 w80 r1 gOperateScript vID_ReloadScript, 重启(&R)
Gui, Add, Button, xp y+15 w80 r1 gOperateScript vID_ExitScript, 退出(&X)
Gui, Add, StatusBar
SB_SetText(" AutoHotkey "
. (A_IsUnicode?"Unicode ":"ANSI ")
. ((A_PtrSize=4)?"32-bit v":"64-bit v")
. A_AhkVersion . " on Windows " . A_OSVersion)
Menu, Tray, Add, Manager(&M), Menu_LableManager
Menu, Tray, Default, Manager(&M)
Menu, Tray, Add, AHKINFO(&S), Menu_LableAHKINFO
Menu, Tray, Add, OpenDir(&D), Menu_LableOpenDir
Menu, Tray, Add, Reload(&R), Reload
Menu, Tray, Add, Help(&H), Menu_Help
Menu, Tray, Add, Exit(&X), ExitSub
Scripts := []
ScriptsCount := 0
Loop, Files, %A_ScriptDir%\Scripts\*.ahk
{
ScriptsCount += 1
Scripts[ScriptsCount] := A_LoopFileName
if InStr(A_LoopFileName, "!"){
Continue
}
else
Run, % A_LoopFileFullPath
}
^!h::
Menu, Tray, Show
Return
getScriptList(){
LV_Delete()
WinGet, AHK_List, List, ahk_class AutoHotkey
Loop, % AHK_List
{
thisID := AHK_List%A_Index%
WinGetTitle, thisTitle, ahk_id %thisID%
thisPaht := StrSplit(thisTitle, " - ")[1]
thisTitle := StrSplit(thisPaht, "\")[StrSplit(thisPaht, "\").length()]
thisPaht := StrReplace(thisPaht, thisTitle, "")
LV_Add("", thisID, thisTitle, thisPaht)
}
LV_ModifyCol(1, "Integer Sort")
LV_ModifyCol(2)
LV_ModifyCol(3)
}
OperateScript:
RowNumber := 0
Loop, % LV_GetCount("Selected")
{
RowNumber := LV_GetNext(RowNumber)
if !RowNumber
break
LV_GetText(CurrentWnd, RowNumber, 1)
CurrentCommand := %A_GuiControl%
PostMessage, %WM_COMMAND%, %CurrentCommand%,,, ahk_id %CurrentWnd%
}
Return
Menu_LableManager:
getScriptList()
Gui, Show
Return
Menu_LableAHKINFO:
run, AHKINFO.exe
Return
Menu_LableOpenDir:
run, %A_ScriptDir%\scripts
Return
Menu_Help:
run, hh.exe AutoHotkey.chm
Return
Reload:
Reload
Return
ExitSub:
Loop, % ScriptsCount{
thisScript := Scripts[A_Index]
WinClose %thisScript% - AutoHotkey
}
Menu, Tray, NoIcon
ExitApp
Return


好的作品就应该顶起来
不错 ? 回头试试