├── 3rd ├── 7-zip.dll ├── 7z.dll ├── 7z.exe ├── ScreenshotView.reg ├── alignColumn.awk ├── clear.cmd ├── cut.exe ├── del.svn.reg ├── gawk.exe ├── gethosts.py ├── grep.exe ├── iconv.exe ├── sed.exe ├── tomcat.test.reg └── trimtail.sed ├── AhkScriptManager.ahk ├── AhkScriptManager.exe ├── HotKeys.txt ├── README.md ├── TabStop Settings.txt ├── ext ├── ScreenshotView.ahk ├── ScreenshotView.exe ├── TomcatUrl.ahk └── TomcatUrl.exe ├── image ├── 主菜单.png ├── 关闭脚本.png ├── 启动脚本.png └── 重载脚本.png ├── lib ├── Anchor.ahk ├── ChangeProcessName.ahk ├── DpiScale.ahk ├── Gdip.ahk ├── HexDec.ahk ├── IEAttach.ahk ├── InsertionSort.ahk ├── StdoutToVar.ahk ├── SystemCursor.ahk └── Taskbar.ahk ├── resources ├── Cmd.png ├── IE.ico ├── JPG .ico └── ahk.ico ├── scripts ├── !AHK帮助.ahk ├── +01.办公软件.ahk ├── +02.日常软件.ahk ├── +03.Oracle服务.ahk ├── +04.一键显隐.ahk ├── +05.清空剪切板.ahk ├── +06.CMD目录.ahk ├── +07.服务.ahk ├── +08.竖列对齐.ahk ├── +09.定位注册表.ahk ├── +10.添加删除程序.ahk ├── +11.网络连接.ahk ├── +12.重启Explorer.ahk ├── +13.关闭任务栏窗口.ahk ├── +14.AHK版本号.ahk ├── +15.下班时间.ahk ├── +16.CmdMarkdownBackup.ahk ├── +17. 更新Hosts.ahk ├── +18. 颜色拾取.ahk ├── CMD.ahk ├── CmdMarkdownCenter.ahk ├── CmdMarkdownRegExp.ahk ├── NetMeter.ahk ├── ObsidianShortcuts.ahk ├── StringFinderHotKey.ahk ├── TODO LIST.ahk ├── Win11中文输入法.ahk ├── 单词统计.ahk ├── 双击关闭Chrome标签页.ahk ├── 我的电脑.ahk ├── 截图.ahk ├── 自动关闭QQ弹窗.ahk └── 锁屏.ahk ├── setup ├── AutoHotkey.chm └── AutoHotkey111401_Install.exe └── testfile ├── ANSI.txt ├── UTF-8+BOM.txt ├── UTF-8.txt ├── Unicode.txt └── file.txt /3rd/7-zip.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/3rd/7-zip.dll -------------------------------------------------------------------------------- /3rd/7z.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/3rd/7z.dll -------------------------------------------------------------------------------- /3rd/7z.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/3rd/7z.exe -------------------------------------------------------------------------------- /3rd/ScreenshotView.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/3rd/ScreenshotView.reg -------------------------------------------------------------------------------- /3rd/alignColumn.awk: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # 将输入文件按照列对齐方式重排,默认分隔符为: 空格, Tab, 逗号, 分号 3 | # 用法:gawk -f alignColumn.awk urfile 4 | # 5 | # gaochao.morgen@gmail.com 6 | # 2013/5/16 7 | ##################################################### 8 | 9 | BEGIN { 10 | FS = "[ \t]+"; 11 | } 12 | { 13 | fpl[FNR] = NF; 14 | for (i=1; i<=NF; i++) { 15 | data[FNR, i] = $i; 16 | if (length($i) > max[i]) { 17 | max[i] = length($i); # max[i]: 第i行的所有域中,最大域的长度 18 | } 19 | } 20 | } 21 | END { 22 | for (l=1; l<=FNR; l++) { # 处理END块时,已经读到文件最后一行. 因此此时的FNR就是文件的行数 23 | for (i=1; i<=fpl[l]; i++) { # fpl[l]: 第l行的域数. 域:每行由FS符号分隔开的都是域 24 | fmt = "%-" max[i] "s"; 25 | if (i > 1) { 26 | printf " "; # 此为每列(除第一列)前默认设置的一个空格 27 | } 28 | printf(fmt, data[l, i]); # data[l,i]: 第l行的第i个域 29 | } 30 | printf "\n"; 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /3rd/clear.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | cls %* 3 | 4 | -------------------------------------------------------------------------------- /3rd/cut.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/3rd/cut.exe -------------------------------------------------------------------------------- /3rd/del.svn.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN] 4 | @="Delete SVN Folders" 5 | 6 | [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command] 7 | @="cmd.exe /c \"TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r \"%1\" %%f IN (.svn) DO RD /s /q \"%%f\" \"" -------------------------------------------------------------------------------- /3rd/gawk.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/3rd/gawk.exe -------------------------------------------------------------------------------- /3rd/gethosts.py: -------------------------------------------------------------------------------- 1 | # !/usr/bin/python 2 | # -*- encoding: utf-8 -*- 3 | 4 | ################################################################# 5 | # BRIEF: Crawler for Hosts File (Python 2.7 required) 6 | # SITE: https://github.com/racaljk/hosts/blob/master/hosts 7 | # AUTHOR: gaochao.morgen@gmail.com 8 | # V1.0 2017-04-28 Create 9 | ################################################################# 10 | 11 | import sys 12 | import cookielib 13 | import urllib 14 | import urllib2 15 | 16 | from lxml import html 17 | 18 | 19 | ################################################## 20 | # Functions # 21 | ################################################## 22 | 23 | 24 | def set_auto_cookie(): 25 | """ 26 | Setup a cookie handler. It will help us handle cookie automatically. 27 | :return: 28 | """ 29 | 30 | global GCJ 31 | GCJ = cookielib.LWPCookieJar() 32 | cookie_support = urllib2.HTTPCookieProcessor(GCJ) 33 | opener = urllib2.build_opener(cookie_support, urllib2.HTTPHandler) 34 | urllib2.install_opener(opener) 35 | 36 | 37 | def require_page_with_http(url, body=None, headers=None): 38 | """ 39 | Require web page using HTTP, and return the page content. 40 | :param url: Full path URL 41 | :param body: POST data(if necessary) 42 | :param headers: More headers(if necessary) 43 | :return: Page Content 44 | """ 45 | 46 | post = (None if body is None else urllib.urlencode(body)) 47 | request = urllib2.Request(url, post) 48 | 49 | http_headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 5.1; rv:45.0) Gecko/20100101 Firefox/45.0'} 50 | if headers is not None: 51 | http_headers.update(headers) 52 | 53 | for key in http_headers: 54 | request.add_header(key, http_headers[key]) 55 | 56 | try: 57 | response = urllib2.urlopen(request) 58 | content = response.read() 59 | if len(content) > 0: 60 | return content 61 | except urllib2.HTTPError, e: 62 | print "The server couldn't fulfill the request." 63 | print "Error code: ", e.code 64 | except urllib2.URLError, e: 65 | print "We failed to reach a server." 66 | print "Reason: ", e.reason 67 | except: 68 | print "Unknown Exception." 69 | 70 | return None 71 | 72 | 73 | ################################################## 74 | # Application # 75 | ################################################## 76 | 77 | if __name__ == "__main__": 78 | set_auto_cookie() 79 | 80 | #page = require_page_with_http('https://github.com/racaljk/hosts/blob/master/hosts') 81 | page = require_page_with_http('https://github.com/googlehosts/hosts/blob/master/hosts-files/hosts') 82 | 83 | # Now we get the web page 84 | tree = html.fromstring(page) 85 | if tree is None: 86 | sys.exit(-1) 87 | 88 | # Parse the web page using XPath 89 | shops = tree.xpath("//td[@class='blob-code blob-code-inner js-file-line']") 90 | try: 91 | f = file('../log/hosts.parsed', 'w') 92 | for shop in shops: 93 | f.write(shop.text + '\n') 94 | f.close() 95 | except: 96 | print 'Parse Error.' 97 | sys.exit(-1) 98 | 99 | sys.exit(0) 100 | 101 | -------------------------------------------------------------------------------- /3rd/grep.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/3rd/grep.exe -------------------------------------------------------------------------------- /3rd/iconv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/3rd/iconv.exe -------------------------------------------------------------------------------- /3rd/sed.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/3rd/sed.exe -------------------------------------------------------------------------------- /3rd/tomcat.test.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/3rd/tomcat.test.reg -------------------------------------------------------------------------------- /3rd/trimtail.sed: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # 将每行末尾的空格删除 3 | # 用法:sed -f trimtail.sed urfile 4 | # 5 | # gaochao.morgen@gmail.com 6 | # 2013/5/16 7 | ##################################################### 8 | 9 | s/[ ]*$//g 10 | -------------------------------------------------------------------------------- /AhkScriptManager.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 蓝蓝小雪 作品 3 | ; http://wwww.snow518.cn/ 4 | ; 修改自:http://ahk.5d6d.com/thread-701-1-3.html 5 | ; 增加了快捷键、编辑、重载某个单独的脚本 6 | ; 7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 8 | ; 9 | ; Ctrl + Alt + 左键 唤出"启动脚本"菜单 10 | ; Ctrl + Alt + 中键 唤出"重载脚本"菜单 11 | ; Ctrl + Alt + 右键 唤出"关闭脚本"菜单 12 | ; Ctrl + Alt + A 关闭所有脚本 13 | ; 14 | ; 注意: 当更新系统环境变量时,需要退出本程序后再重启,才能使得环境变量的更改有效 15 | ; 16 | ; 删除一些不必要的功能,增加非驻守脚本(文件名以"+"开头)的处理 17 | ; gaochao.morgen@gmail.com 18 | ; 2014/2/1 19 | ; 20 | ; 增加菜单排序功能 21 | ; gaochao.morgen@gmail.com 22 | ; 2014/2/10 23 | ; 24 | ; 增加进程PID显示 25 | ; gaochao.morgen@gmail.com 26 | ; 2014/2/13 27 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 28 | 29 | #Include lib/InsertionSort.ahk 30 | 31 | #Persistent 32 | #SingleInstance force 33 | 34 | SetWorkingDir %A_ScriptDir%\scripts\ 35 | 36 | DetectHiddenWindows On ; 允许探测脚本中隐藏的主窗口. 很多子程序均是以隐藏方式运行的 37 | SetTitleMatchMode 2 ; 避免需要指定如下所示的文件的完整路径 38 | 39 | EnvGet, Paths, PATH 40 | EnvSet, PATH, %A_ScriptDir%\3rd`;%Paths% ; 设置环境变量. 通过AhkScriptManager启动的程序均持有该环境变量 41 | 42 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 43 | ; 初始化 ; 44 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 45 | 46 | scriptCount = 0 47 | 48 | OnExit ExitSub 49 | 50 | GoSub CreateMenus 51 | 52 | OpenListTemp := Array() ; 已运行程序列表中的临时驻守脚本 53 | OpenListDeamon := Array() ; 已运行程序列表中的驻守脚本 54 | 55 | UnOpenListTemp := Array() ; 未运行程序列表中的临时驻守脚本 56 | UnOpenListOnce := Array() ; 未运行程序列表中的非驻守脚本 57 | UnOpenListDeamon := Array() ; 未运行程序列表中的驻守脚本 58 | 59 | ; 遍历scripts目录下的ahk文件 60 | Loop, %A_ScriptDir%\scripts\*.ahk 61 | { 62 | StringTrimRight, menuName, A_LoopFileName, StrLen(".ahk") 63 | scriptCount += 1 64 | 65 | ; 已经打开则关闭,否则无法被AHK Manager接管 66 | IfWinExist, %A_LoopFileName% - AutoHotkey 67 | { 68 | scriptsExisted%scriptCount% = 1 69 | WinKill 70 | } 71 | 72 | scriptsName%scriptCount% := A_LoopFileName 73 | scriptsOpened%scriptCount% = 0 74 | 75 | IfInString, menuName, ! ; 文件名中含"!"表示临时驻守脚本 76 | { 77 | UnOpenListTemp.Insert(menuName) 78 | Continue 79 | } 80 | 81 | IfInString, menuName, + ; 文件名中含"+"表示非驻守脚本 82 | { 83 | UnOpenListOnce.Insert(menuName) 84 | Continue 85 | } 86 | 87 | UnOpenListDeamon.Insert(menuName) 88 | } 89 | 90 | ; 依次添加脚本到启动脚本菜单,类型间加入分隔线 91 | AddToUnOpenMenu(UnOpenListTemp) 92 | AddToUnOpenMenu(UnOpenListOnce) 93 | AddToUnOpenMenu(UnOpenListDeamon, false) 94 | 95 | ; 主菜单 96 | Menu, Tray, Icon, %A_ScriptDir%\resources\ahk.ico 97 | Menu, Tray, Click, 1 98 | Menu, Tray, Tip, AHK Script Manager 99 | Menu, Tray, Add, AHK Script Manager, Menu_Show 100 | Menu, Tray, ToggleEnable, AHK Script Manager 101 | Menu, Tray, Default, AHK Script Manager 102 | Menu, Tray, Add 103 | Menu, Tray, Add, 启动脚本(&S)`tCtrl + Alt + 左键, :scripts_unopen ; S: Start 104 | Menu, Tray, Add 105 | Menu, Tray, Add, 重载脚本(&R)`tCtrl + Alt + 中键, :scripts_restart ; R: Restart 106 | Menu, Tray, Add, 关闭脚本(&C)`tCtrl + Alt + 右键, :scripts_unclose ; C: Close 107 | Menu, Tray, Add, 关闭所有脚本(&A)`tCtrl + Alt + A, tsk_closeAll ; A: All 108 | Menu, Tray, Add 109 | Menu, Tray, Add, 进程管理(&P), tsk_showproc ; P: Process 110 | Menu, Tray, Add 111 | Menu, Tray, Add, 打开源码目录(&D), Menu_Tray_OpenDir ; D: Directory 112 | Menu, Tray, Add 113 | Menu, Tray, Add, 重启Manager(&B), Menu_Tray_Reload ; B: reBoot 114 | Menu, Tray, Add 115 | Menu, Tray, Add, 退出(&X)`tCtrl + Alt + X, Menu_Tray_Exit 116 | Menu, Tray, NoStandard 117 | 118 | ; 程序启动时,加载所有可启动脚本 119 | GoSub tsk_openAll 120 | 121 | Return 122 | 123 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 124 | ; 快捷键设置 ; 125 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 126 | 127 | ; Ctrl + Alt + LButton, 启动 128 | ^!LButton:: 129 | Menu, scripts_unopen, Show 130 | Return 131 | 132 | ; Ctrl + Alt + RButton, 关闭 133 | ^!RButton:: 134 | Menu, scripts_unclose, Show 135 | Return 136 | 137 | ; Ctrl + Alt + MButton, 重载 138 | ^!MButton:: 139 | Menu, scripts_restart, Show 140 | Return 141 | 142 | ; Ctrl + Alt + A, 关闭所有 143 | ^!A:: 144 | Goto tsk_closeAll 145 | Return 146 | 147 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 148 | ; 菜单事件响应 ; 149 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 150 | 151 | ; 启动选中脚本 152 | tsk_open: 153 | Loop, %scriptCount% 154 | { 155 | thisScript := scriptsName%A_Index% 156 | if thisScript = %A_ThisMenuItem%.ahk 157 | { 158 | IfWinNotExist, %thisScript% - AutoHotkey ; 没有打开 159 | Run, %A_ScriptDir%\scripts\%thisScript% 160 | 161 | IfInString, thisScript, + ; 文件名中含"+"表示非驻守脚本 162 | Break 163 | 164 | scriptsOpened%A_Index% := 1 165 | Break 166 | } 167 | } 168 | GoSub RecreateMenus 169 | Return 170 | 171 | ; 关闭选中脚本 172 | tsk_close: 173 | Loop, %scriptCount% 174 | { 175 | thisScript := scriptsName%A_Index% 176 | if thisScript = %A_ThisMenuItem%.ahk 177 | { 178 | WinClose, %thisScript% - AutoHotkey 179 | scriptsOpened%A_Index% := 0 180 | Break 181 | } 182 | } 183 | GoSub RecreateMenus 184 | Return 185 | 186 | ; 重新启动选中脚本 187 | tsk_restart: 188 | Loop, %scriptCount% 189 | { 190 | thisScript := scriptsName%A_Index% 191 | if thisScript = %A_ThisMenuItem%.ahk 192 | { 193 | WinClose, %thisScript% - AutoHotkey 194 | Run, %A_ScriptDir%\scripts\%thisScript% 195 | Break 196 | } 197 | } 198 | Return 199 | 200 | ; 启动所有驻守脚本,从读文件开始就已经被排序了,所以无需排序 201 | tsk_openAll: 202 | Loop, %scriptCount% 203 | { 204 | thisScript := scriptsName%A_Index% 205 | if scriptsOpened%A_Index% = 0 ; 没打开 206 | { 207 | IfInString, thisScript, ! ; 文件名中含"!"表示临时驻守脚本,则不启动 208 | { 209 | if scriptsExisted%A_Index% != 1 ; AHK Manager启动前该脚本未启动 210 | Continue 211 | } 212 | 213 | IfInString, thisScript, + ; 文件名中含"+"表示非驻守脚本,不启动 214 | { 215 | if scriptsExisted%A_Index% != 1 216 | Continue 217 | } 218 | 219 | IfWinNotExist, %thisScript% - AutoHotkey ; 没有打开 220 | { 221 | Run, %A_ScriptDir%\scripts\%thisScript% 222 | 223 | scriptsOpened%A_Index% = 1 224 | StringRePlace, menuName, thisScript, .ahk 225 | Menu, scripts_unclose, Add, %menuName%, tsk_close 226 | Menu, scripts_restart, Add, %menuName%, tsk_restart 227 | Menu, scripts_unopen, Delete, %menuName% 228 | } 229 | } 230 | } 231 | Return 232 | 233 | ; 在ListView控件中显示脚本进程PID 234 | tsk_showproc: 235 | WmiInfo := GetWMI("AutoHotkey.exe") 236 | ShowIndex := 0 237 | Gui, Font, s9, Arial 238 | Gui, Add, ListView, x2 y0 w250 h200, Index|PID|Script Name|Memory 239 | Loop, %scriptCount% 240 | { 241 | thisScript := scriptsName%A_Index% 242 | if scriptsOpened%A_Index% = 1 ; 已打开 243 | { 244 | ShowIndex += 1 245 | WinGet, procId, PID, %thisScript% - AutoHotkey 246 | memory := GetMemory(WmiInfo, procId) 247 | LV_Add("", ShowIndex, procId, thisScript, memory) 248 | } 249 | } 250 | LV_ModifyCol() ; 根据内容自动调整每列的大小 251 | Gui, Show,, Process List 252 | Return 253 | 254 | ; 关闭ListView控件 255 | GuiClose: 256 | Gui, Destroy 257 | Return 258 | 259 | ; 关闭所有脚本 260 | tsk_closeAll: 261 | Loop, %scriptCount% 262 | { 263 | thisScript := scriptsName%A_Index% 264 | if scriptsOpened%A_Index% = 1 ; 已打开 265 | { 266 | WinClose, %thisScript% - AutoHotkey 267 | scriptsOpened%A_Index% = 0 268 | 269 | StringRePlace, menuName, thisScript, .ahk 270 | Menu, scripts_unopen, Add, %menuName%, tsk_open 271 | Menu, scripts_unclose, Delete, %menuName% 272 | Menu, scripts_restart, Delete, %menuName% 273 | } 274 | } 275 | Return 276 | 277 | ; 打开源码目录 278 | Menu_Tray_OpenDir: 279 | Run, %A_ScriptDir%\scripts,, Max 280 | Return 281 | 282 | ; 重启Manager 283 | Menu_Tray_Reload: 284 | Reload 285 | Return 286 | 287 | ; 退出 288 | Menu_Tray_Exit: 289 | ExitApp 290 | Return 291 | 292 | Menu_Show: 293 | Menu, Tray, Show 294 | Return 295 | 296 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 297 | ; 创建菜单 ; 298 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 299 | 300 | ; 创建子菜单 301 | CreateMenus: 302 | ; "启动脚本"子菜单 303 | Menu, scripts_unopen, Add, 启动脚本, Menu_Tray_Exit 304 | Menu, scripts_unopen, ToggleEnable, 启动脚本 305 | Menu, scripts_unopen, Default, 启动脚本 306 | Menu, scripts_unopen, Add 307 | 308 | ; "关闭脚本"子菜单 309 | Menu, scripts_unclose, Add, 关闭脚本, Menu_Tray_Exit 310 | Menu, scripts_unclose, ToggleEnable, 关闭脚本 311 | Menu, scripts_unclose, Default, 关闭脚本 312 | Menu, scripts_unclose, Add 313 | 314 | ; "重载脚本"子菜单 315 | Menu, scripts_restart, Add, 重载脚本, Menu_Tray_Exit 316 | Menu, scripts_restart, ToggleEnable, 重载脚本 317 | Menu, scripts_restart, Default, 重载脚本 318 | Menu, scripts_restart, Add 319 | Return 320 | 321 | ; 重建子菜单 322 | RecreateMenus: 323 | Menu, scripts_unopen, DeleteAll ; 剩下空菜单 324 | Menu, scripts_unclose, DeleteAll ; 剩下空菜单 325 | Menu, scripts_restart, DeleteAll ; 剩下空菜单 326 | 327 | GoSub CreateMenus 328 | 329 | OpenListTemp := Array() 330 | OpenListDeamon := Array() 331 | 332 | UnOpenListTemp := Array() 333 | UnOpenListOnce := Array() 334 | UnOpenListDeamon := Array() 335 | 336 | Loop, %scriptCount% 337 | { 338 | StringTrimRight, menuName, scriptsName%A_Index%, StrLen(".ahk") 339 | if scriptsOpened%A_Index% = 1 340 | { 341 | IfInString, menuName, ! ; 文件名中含"!"表示临时驻守脚本 342 | { 343 | OpenListTemp.Insert(menuName) 344 | Continue 345 | } 346 | 347 | OpenListDeamon.Insert(menuName) 348 | } 349 | else if scriptsOpened%A_Index% = 0 350 | { 351 | IfInString, menuName, ! ; 文件名中含"!"表示临时驻守脚本 352 | { 353 | UnOpenListTemp.Insert(menuName) 354 | Continue 355 | } 356 | 357 | IfInString, menuName, + ; 文件名中含"+"表示非驻守脚本 358 | { 359 | UnOpenListOnce.Insert(menuName) 360 | Continue 361 | } 362 | 363 | UnOpenListDeamon.Insert(menuName) 364 | } 365 | } 366 | 367 | ; 依次添加脚本到重载脚本/关闭脚本菜单,类型间加入分隔线 368 | AddToOpenMenu(OpenListTemp) 369 | AddToOpenMenu(OpenListDeamon, false) 370 | 371 | ; 依次添加脚本到启动脚本菜单,类型间加入分隔线 372 | AddToUnOpenMenu(UnOpenListTemp) 373 | AddToUnOpenMenu(UnOpenListOnce) 374 | AddToUnOpenMenu(UnOpenListDeamon, false) 375 | Return 376 | 377 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 378 | ; 程序清理 ; 379 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 380 | 381 | ExitSub: 382 | Loop, %scriptCount% 383 | { 384 | thisScript := scriptsName%A_Index% 385 | if scriptsOpened%A_Index% = 1 ; 已打开 386 | { 387 | WinClose, %thisScript% - AutoHotkey 388 | scriptsOpened%A_Index% = 0 389 | 390 | StringRePlace, menuName, thisScript, .ahk 391 | } 392 | } 393 | Menu, Tray, NoIcon 394 | ExitApp 395 | Return 396 | 397 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 398 | ; 函数 ; 399 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 400 | 401 | ; 给定进程名称,返回该进程的所有信息 402 | GetWMI(ProcessName) 403 | { 404 | objWMI := ComObjGet("winmgmts:\\.\root\cimv2") ; 连接到WMI服务 405 | StrSql := "SELECT * FROM Win32_Process WHERE Name=""" 406 | StrSql .= ProcessName 407 | StrSql .= """" 408 | Info := objWMI.ExecQuery(StrSql) 409 | Return Info 410 | } 411 | 412 | ; 给定进程PID,获取其内存消耗 413 | GetMemory(WmiInfo, PID) 414 | { 415 | for ObjProc in WmiInfo 416 | { 417 | if (ObjProc.ProcessID = PID) 418 | { 419 | usage := Round(ObjProc.WorkingSetSize / 1024) 420 | Return % usage . "K" 421 | } 422 | } 423 | 424 | Return "0K" 425 | } 426 | 427 | ; 为启动脚本菜单添加一种类型的脚本 428 | AddToUnOpenMenu(UnOpenList, AllowSplit=true) 429 | { 430 | InsertionSort(UnOpenList) 431 | for Index, menuName in UnOpenList 432 | Menu, scripts_unopen, add, %menuName%, tsk_open 433 | 434 | ; 必要时加分隔线 435 | if (AllowSplit = true) 436 | { 437 | for Files in UnOpenList 438 | { 439 | Menu, scripts_unopen, Add 440 | Break 441 | } 442 | } 443 | } 444 | 445 | ; 为重载脚本/关闭脚本菜单添加一种类型的脚本 446 | AddToOpenMenu(OpenList, AllowSplit=true) 447 | { 448 | InsertionSort(OpenList) 449 | for Index, menuName in OpenList 450 | { 451 | Menu, scripts_unclose, Add, %menuName%, tsk_close 452 | Menu, scripts_restart, Add, %menuName%, tsk_restart 453 | } 454 | 455 | ; 必要时加分隔线 456 | if (AllowSplit = true) 457 | { 458 | for Files in OpenList 459 | { 460 | Menu, scripts_unclose, Add 461 | Menu, scripts_restart, Add 462 | Break 463 | } 464 | } 465 | } 466 | 467 | -------------------------------------------------------------------------------- /AhkScriptManager.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/AhkScriptManager.exe -------------------------------------------------------------------------------- /HotKeys.txt: -------------------------------------------------------------------------------- 1 | AhkScriptManager 2 | Ctrl + Alt + A 关闭所有脚本 3 | Ctrl + Alt + 中键 唤出"重载脚本"菜单 4 | Ctrl + Alt + 右键 唤出"关闭脚本"菜单 5 | Ctrl + Alt + 左键 唤出"启动脚本"菜单 6 | 7 | !AHK帮助.ahk 8 | Alt + H 在AHK帮助文件中查找剪切板内容 9 | 10 | CMD.ahk 11 | Ctrl + L 仿Linux Term下Ctrl+L的清屏行为 12 | Ctrl + U 清空当前输入的命令 13 | Ctrl + V CMD窗口粘贴 14 | 15 | TODO LIST.ahk 16 | Enter 保存 17 | Ctrl + Enter 文本换行 18 | 19 | 单词统计.ahk 20 | F12 统计当前选中文字中的中英文单词数 21 | 22 | 截图.ahk 23 | Ctrl + Shift + 左键 截图存为PNG图片,并保存到桌面 24 | Ctrl + Shift + 右键 截图保存到ClipBoard中,用于直接粘贴 25 | 26 | 锁屏.ahk 27 | Win + L 锁屏并关闭屏幕 28 | 29 | 我的电脑.ahk 30 | Win + E 打开我的电脑 31 | 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AhkScriptManager 2 | 3 | AhkScriptManager 是一款用于管理常用 AHK 脚本执行的桌面工具,它可以方便地控制常用 AHK 脚本的启动、关闭、重载。本项目致力于常用 AHK 脚本的开发,而 `AhkScriptManager.ahk` 的变动可能会比较小。 4 | 5 | 接触 AHK 一段时间以后,已经积累了不少脚本,有各种大牛的,有自己写的。一些脚本确实会加快日常操作,但是哪些脚本需要常驻,哪些脚本需要临时启动停止,状态栏存在过多的 Tray 图标等等成了一个棘手的问题。 6 | 7 | 最先见到 AhkScriptManager 是在小众软件上: http://www.appinn.com/ahk-script-manager/ ,它的出现让我的困惑得以消除。我对其进行了一些改造,形成了本文这个工具,解决了上述问题。 8 | 9 |

10 | 11 | 工具中出现了很多脚本,对于任何个人来说,这些脚本当中有些是适用的,有些却是不适用的,需要自己裁剪和改造。 12 | 13 | AHK 是一门功能强大的脚本语言,然而语法稍显晦涩。本项目也是一个非常好的参考示例,集中了大量常见的用法,可以当做一个快速的语法参考。 14 | 15 | AhkScriptManager 仅接管 `scripts` 目录中的脚本,对已运行的其他脚本不会造成影响(但存在热键冲突风险)。因此个人新添加的脚本必须加入到 `scripts` 目录,并重启 AhkScriptManager 以便刷新。 16 | 17 | 本软件在 XP/Server2003/Win7/Win10 上稳定运行,Win11 下大部分功能都没有啥问题。 18 | 19 | **注意**:Win7系统对程序权限控制较为严格,某些指令执行时需要管理员权限,比如 `+03.Oracle服务.ahk` 里使用了 `cmd /c net start` 命令,如果没有以管理员权限运行,程序将不会正确执行。建议将 `AhkScriptManager.exe` 设置为以管理员权限运行(程序上点击右键,选择属性,选择兼容性,勾选以管理员身份运行此程序),这样可以保证 `scripts` 目录里的脚本均以管理员权限运行。 20 | 21 | ## 安装说明 22 | 23 | 1. 安装 `setup/AutoHotkey111401_Install.exe`。 24 | 25 | 2. 将 `setup/AutoHotkey.chm` 拷贝到 `C:\Program Files\AutoHotkey` 目录,此步骤作用是用中文文档覆盖英文文档。 26 | 27 | 3. ~~将 `3rd` 目录添加到 PATH 中,方便 AhkScriptManager 调用这些外部程序。~~ AhkScriptManager 启动时已经将 `3rd` 目录自动加入 PATH。 28 | 29 | 4. 运行 `AhkScriptManager.exe`,任务栏右下角将出现该程序图标。 30 | 31 | ## 不同格式的 ahk 脚本命名代表不同含义 32 | * 正常命名的脚本: 会随 AhkScriptManager 启动而启动,关闭而关闭,适用于常驻脚本。通常这种脚本中含有快捷键,或者含有 GUI,或者含有 Timer。 33 | 34 | * `!` 开头的脚本: 需要手动启动(`Alt+Ctrl+左键`),启动后会驻守,可以手动关闭,适用于某段时间需要常驻的脚本。这种脚本在结束时通常要考虑恢复系统的一些状态。 35 | 36 | * `+` 开头的脚本: 启动后只执行一次任务,执行完自动退出或手动退出,不会驻守,适用于执行一次性任务。通常用来完成一些简单任务,比如启动应用程序。 37 | 38 | ## 快捷键说明 39 | 参见 [HotKeys.txt](https://github.com/morgengc/AHK-Script-Manager/blob/master/HotKeys.txt)。 40 | 41 | **注意**:快捷键组合中,应先按 `Alt`,再按 `Ctrl`,再按其他键。先按 `Ctrl` 再按 `Alt` 唤出的菜单会闪退,谁能告诉我原因。。。 42 | 43 | 个人愿望,是希望通过 AhkScriptManager 方便桌面操作。但对于快捷键的使用上,主张够用就好,本人并不赞同太多的快捷键设置。 44 | 45 | ## 目录设置 46 | | 目录 | 说明 | 47 | | ---- | ---- | 48 | | 3rd | 项目使用的其他类型脚本和应用程序 | 49 | | config | "TODO LIST"脚本使用的配置文件目录 | 50 | | ext | 保存外部调用脚本。比如鼠标右键单击要触发一个事件,事件处理放在脚本中 | 51 | | image | 程序界面截图 | 52 | | lib | 项目使用的第三方AHK脚本库 | 53 | | resources | 程序图标 | 54 | | scripts | 脚本目录 | 55 | | setup | AHK安装包及帮助文件 | 56 | | AhkScriptManager.ahk | 主程序源码 | 57 | | AhkScriptManager.exe | 主程序可执行程序 | 58 | | HotKeys.txt | 项目定义的热键 | 59 | | readme.md | 本文件 | 60 | | TabStop Settings.txt | 各种常见文本编辑器按此设置,以便代码缩进风格统一 | 61 | 62 | ## 软件配置 63 | | 软件 | 版本 | 64 | | ---- | ---- | 65 | | AHK | AutoHotkey_L Unicode, 版本号1.1.14.01 | 66 | | 操作系统 | Windows XP SP3/Windows Server 2003/Windows7 | 67 | | ahk脚本编码 | UTF-8+BOM | 68 | 69 | 70 | -------------------------------------------------------------------------------- /TabStop Settings.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/TabStop Settings.txt -------------------------------------------------------------------------------- /ext/ScreenshotView.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 经常需要从网页中截取一些重要文章,保存为PNG文件 3 | ; 用Windows自带的图像浏览器打开,默认会自适应窗口,往往造成图片过小,需要手动调整为100%显示才能正常阅读 4 | ; 为此使用该程序,默认就以100%显示 5 | ; 6 | ; 本程序如果想要一个标题栏是比较困难的,因为使用了WS_EX_LAYERED拓展属性. 7 | ; 如果想要显示一个标题栏,则需要换一种方法. 8 | ; 9 | ; 使用方法: 10 | ; 1. 注册3rd/ScreenshotView.reg,使右键菜单中加入ScreenshotView. 此操作仅需一次 11 | ; 2. 在需要浏览的文件上点击右键,选择ScreenshotView打开 12 | ; 13 | ; gaochao.morgen@gmail.com 14 | ; 2016/6/12 15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 16 | 17 | #SingleInstance, Force 18 | #NoEnv 19 | SetBatchLines, -1 20 | 21 | #Include ../lib/Gdip.ahk 22 | #Include ../lib/DpiScale.ahk 23 | 24 | ToolBarHeight := Round(28*GetDpiScale()) ; 任务栏高度 25 | Times := 0 ; 鼠标滚动次数 26 | ViewHeight := Round((A_ScreenHeight-ToolBarHeight)) ; 可视高度. 亦即图层的高度 27 | Distance := Round(ViewHeight/2) ; 每次滚动距离 28 | 29 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 30 | ; GUI ; 31 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 32 | 33 | ; Start gdi+ 34 | If !pToken := Gdip_Startup() 35 | { 36 | MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system 37 | ExitApp 38 | } 39 | OnExit, GuiClose 40 | 41 | ; -Owner 出现在任务栏 42 | ; -Caption 无标题栏 43 | ; +E0x80000 E表示窗口的拓展属性,0x80000即WS_EX_LAYERED. 创建一个layered window. 后面必须调用UpdateLayeredWindow()才会更新显示 44 | ; +LastFound "上次找到的" 窗口, 让脚本更容易创建和维护 45 | ; +OwnDialogs 让后续的对话框成为当前窗口的子窗口 46 | ; +HwndMainHwnd Hwnd保存到MainHwnd中 47 | Gui, 1: -Owner -Caption +E0x80000 +LastFound +OwnDialogs +HwndMainHwnd 48 | Gui, 1: Show, Maximize 49 | 50 | ; 获取图片文件全名 51 | Loop, %0% 52 | { 53 | PicName := %A_Index% 54 | ;MsgBox, %PicName% 55 | Break 56 | } 57 | 58 | ; 加载图片文件 59 | pBitmap := Gdip_CreateBitmapFromFile(PicName) 60 | If !pBitmap 61 | { 62 | MsgBox, 48, File loading error!, Could not load the image specified 63 | ExitApp 64 | } 65 | 66 | ; 原始图片宽度和高度 67 | PicWidth := Gdip_GetImageWidth(pBitmap) 68 | PicHeight := Gdip_GetImageHeight(pBitmap) 69 | 70 | ; 这个相当于画布,图像绘制在该区域 71 | hbm := CreateDIBSection(A_ScreenWidth, ViewHeight) 72 | hdc := CreateCompatibleDC() ; Get a device context compatible with the screen 73 | obm := SelectObject(hdc, hbm) ; Select the bitmap into the device context 74 | G := Gdip_GraphicsFromHDC(hdc) ; Get a pointer to the graphics of the bitmap, for use with drawing functions 75 | 76 | ; 画一个灰色背景 77 | pBrush := Gdip_BrushCreateSolid(0xFFD9D9D9) 78 | Gdip_FillRectangle(G, pBrush, 0, 0, A_ScreenWidth, ViewHeight) 79 | Gdip_DeleteBrush(pBrush) 80 | 81 | Gosub PicDown 82 | Return 83 | 84 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 85 | ; 响应鼠标滚动事件 ; 86 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 87 | 88 | ; 向下滚动图片 89 | #IfWinActive ahk_class AutoHotkeyGUI 90 | WheelDown:: 91 | PicDown: 92 | ; 原图像中仅显示(sx, sy, sw, sh)区域 93 | ; 通常原图像的宽度都不会比屏幕宽(因为本程序浏览对象基本上都是网页截图),但高度通常会比屏幕高 94 | sx := 0 95 | sy := Round(Distance*Times) 96 | sw := PicWidth 97 | sh := (ViewHeight < PicHeight) ? ViewHeight : PicHeight 98 | if (sy + sh >= PicHeight) { 99 | sy := PicHeight - sh 100 | ;FileAppend, sy=%sy% sh=%sh%`n, debug.txt 101 | } else { 102 | Times++ 103 | } 104 | 105 | ; 居中显示到这个位置 106 | dx := Round((A_ScreenWidth/2) - (PicWidth/2)) 107 | dy := Round((ViewHeight/2) - (sh/2)) 108 | dw := sw 109 | dh := sh 110 | 111 | ; 显示图片 112 | Gdip_DrawImage(G, pBitmap, dx, dy, dw, dh, sx, sy, sw, sh) 113 | 114 | ; 更新MainHwnd窗口 115 | UpdateLayeredWindow(MainHwnd, hdc, 0, 0, A_ScreenWidth, ViewHeight) 116 | Return 117 | 118 | ; 向上滚动图片 119 | #IfWinActive ahk_class AutoHotkeyGUI 120 | WheelUp:: 121 | if (Times <= 0) { 122 | Return 123 | } else { 124 | Times-- 125 | } 126 | 127 | ; 原图像中仅显示(sx, sy, sw, sh)区域 128 | ; 通常原图像的宽度都不会比屏幕宽(因为本程序浏览对象基本上都是网页截图),但高度通常会比屏幕高 129 | sx := 0 130 | sy := Round(Distance*Times) 131 | sw := PicWidth 132 | sh := (ViewHeight < PicHeight) ? ViewHeight : PicHeight 133 | 134 | ; 居中显示到这个位置 135 | dx := Round((A_ScreenWidth/2) - (PicWidth/2)) 136 | dy := Round((ViewHeight/2) - (sh/2)) 137 | dw := sw 138 | dh := sh 139 | 140 | ; 显示图片 141 | Gdip_DrawImage(G, pBitmap, dx, dy, dw, dh, sx, sy, sw, sh) 142 | 143 | ; 更新MainHwnd窗口 144 | UpdateLayeredWindow(MainHwnd, hdc, 0, 0, A_ScreenWidth, ViewHeight) 145 | Return 146 | 147 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 148 | ; 清理资源 ; 149 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 150 | 151 | Esc:: 152 | q:: 153 | RButton Up:: ; 只有右键弹起时才起效. 否则关闭窗口以后,右键事件会传递到后面的窗口 154 | Gosub GuiClose 155 | Return 156 | 157 | GuiClose: 158 | SelectObject(hdc, obm) ; Select the object back into the hdc 159 | DeleteObject(hbm) ; Now the bitmap may be deleted 160 | DeleteDC(hdc) ; Also the device context related to the bitmap may be deleted 161 | Gdip_DeleteGraphics(G) ; The graphics may now be deleted 162 | Gdip_DisposeImage(pBitmap) ; The bitmap we made from the image may be deleted 163 | 164 | Gdip_Shutdown(pToken) ; gdi+ may now be shutdown on exiting the program 165 | ExitApp 166 | Return 167 | 168 | -------------------------------------------------------------------------------- /ext/ScreenshotView.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/ext/ScreenshotView.exe -------------------------------------------------------------------------------- /ext/TomcatUrl.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 在Tomcat\webapps目录的子目录下右键点击网页,生成测试URL,并自动打开Firefox测试 3 | ; NOTE: 给文件右键添加菜单需要运行注册表3rd/webpage.test.reg 4 | ; 需要定义三个环境变量: 5 | ; set TomcatHome=F:\编程与优化\Java\apache-tomcat-7.0.59\webapps 6 | ; set BrowserHome=C:\Program Files\Internet Explorer\iexplore.exe 7 | ; set TomcatPrefix=http://localhost:8080/ 8 | ; 9 | ; Chao.Gao@cisdi.com.cn 10 | ; 2015/5/12 11 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 12 | 13 | WebPageFullName := "" 14 | 15 | ; 获取文件全名 16 | Loop, %0% 17 | { 18 | WebPageFullName := %A_Index% 19 | ;MsgBox, %WebPageFullName% 20 | Break 21 | } 22 | 23 | ; 获取webapps下子目录名称 TomcatDir := "F:\编程与优化\Java\apache-tomcat-7.0.59\webapps\" 24 | EnvGet, TomcatDir, TomcatHome 25 | 26 | ; 若环境变量最后一个字符不是"\",则在结尾处追加一个"\"字符 27 | if (SubStr(TomcatDir, 0, 1) <> "\") 28 | TomcatDir .= "\" 29 | 30 | ;MsgBox, %TomcatDir% 31 | 32 | ; 若选取的文件不在Tomcat的子目录下,则不做任何操作 33 | if (!InStr(WebPageFullName, TomcatDir)) 34 | Return 35 | 36 | ; 构造URL Url := "http://localhost:8080/" 37 | EnvGet, Url, TomcatPrefix 38 | if (SubStr(Url, 0, 1) <> "/") 39 | Url .= "/" 40 | 41 | ; 获取web项目名称 42 | UrlSuffix := SubStr(WebPageFullName, StrLen(TomcatDir)+1) 43 | ; 本地文件路径分隔符"\"改为URL分隔符"/" 44 | StringReplace, UrlSuffix, UrlSuffix, \, /, All 45 | Url .= UrlSuffix 46 | 47 | ; 用浏览器打开 Navigator := "C:\Program Files\Mozilla Firefox\firefox.exe" 48 | EnvGet, Navigator, BrowserHome 49 | BroweCmd := Navigator 50 | BroweCmd .= " " 51 | BroweCmd .= Url 52 | 53 | Run, %BroweCmd% 54 | 55 | -------------------------------------------------------------------------------- /ext/TomcatUrl.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/ext/TomcatUrl.exe -------------------------------------------------------------------------------- /image/主菜单.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/image/主菜单.png -------------------------------------------------------------------------------- /image/关闭脚本.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/image/关闭脚本.png -------------------------------------------------------------------------------- /image/启动脚本.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/image/启动脚本.png -------------------------------------------------------------------------------- /image/重载脚本.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/image/重载脚本.png -------------------------------------------------------------------------------- /lib/Anchor.ahk: -------------------------------------------------------------------------------- 1 | /* 2 | Function: Anchor 3 | Defines how controls should be automatically positioned relative to the new dimensions of a window when resized. 4 | 5 | Parameters: 6 | cl - a control HWND, associated variable name or ClassNN to operate on 7 | a - (optional) one or more of the anchors: 'x', 'y', 'w' (width) and 'h' (height), 8 | optionally followed by a relative factor, e.g. "x h0.5" 9 | r - (optional) true to redraw controls, recommended for GroupBox and Button types 10 | 11 | Examples: 12 | > "xy" ; bounds a control to the bottom-left edge of the window 13 | > "w0.5" ; any change in the width of the window will resize the width of the control on a 2:1 ratio 14 | > "h" ; similar to above but directrly proportional to height 15 | 16 | Remarks: 17 | To assume the current window size for the new bounds of a control (i.e. resetting) simply omit the second and third parameters. 18 | However if the control had been created with DllCall() and has its own parent window, 19 | the container AutoHotkey created GUI must be made default with the +LastFound option prior to the call. 20 | For a complete example see anchor-example.ahk. 21 | 22 | License: 23 | - Version 4.60a 24 | - New BSD License 25 | */ 26 | Anchor(i, a = "", r = false) { 27 | static c, cs = 12, cx = 255, cl = 0, g, gs = 8, gl = 0, gpi, gw, gh, z = 0, k = 0xffff 28 | If z = 0 29 | VarSetCapacity(g, gs * 99, 0), VarSetCapacity(c, cs * cx, 0), z := true 30 | If (!WinExist("ahk_id" . i)) { 31 | GuiControlGet, t, Hwnd, %i% 32 | If ErrorLevel = 0 33 | i := t 34 | Else ControlGet, i, Hwnd, , %i% 35 | } 36 | VarSetCapacity(gi, 68, 0), DllCall("GetWindowInfo", "UInt", gp := DllCall("GetParent", "UInt", i), "UInt", &gi) 37 | , giw := NumGet(gi, 28, "Int") - NumGet(gi, 20, "Int"), gih := NumGet(gi, 32, "Int") - NumGet(gi, 24, "Int") 38 | If (gp != gpi) { 39 | gpi := gp 40 | Loop, %gl% 41 | If (NumGet(g, cb := gs * (A_Index - 1)) == gp) { 42 | gw := NumGet(g, cb + 4, "Short"), gh := NumGet(g, cb + 6, "Short"), gf := 1 43 | Break 44 | } 45 | If (!gf) 46 | NumPut(gp, g, gl), NumPut(gw := giw, g, gl + 4, "Short"), NumPut(gh := gih, g, gl + 6, "Short"), gl += gs 47 | } 48 | ControlGetPos, dx, dy, dw, dh, , ahk_id %i% 49 | Loop, %cl% 50 | If (NumGet(c, cb := cs * (A_Index - 1)) == i) { 51 | If a = 52 | { 53 | cf = 1 54 | Break 55 | } 56 | giw -= gw, gih -= gh, as := 1, dx := NumGet(c, cb + 4, "Short"), dy := NumGet(c, cb + 6, "Short") 57 | , cw := dw, dw := NumGet(c, cb + 8, "Short"), ch := dh, dh := NumGet(c, cb + 10, "Short") 58 | Loop, Parse, a, xywh 59 | If A_Index > 1 60 | av := SubStr(a, as, 1), as += 1 + StrLen(A_LoopField) 61 | , d%av% += (InStr("yh", av) ? gih : giw) * (A_LoopField + 0 ? A_LoopField : 1) 62 | DllCall("SetWindowPos", "UInt", i, "Int", 0, "Int", dx, "Int", dy 63 | , "Int", InStr(a, "w") ? dw : cw, "Int", InStr(a, "h") ? dh : ch, "Int", 4) 64 | If r != 0 65 | DllCall("RedrawWindow", "UInt", i, "UInt", 0, "UInt", 0, "UInt", 0x0101) ; RDW_UPDATENOW | RDW_INVALIDATE 66 | Return 67 | } 68 | If cf != 1 69 | cb := cl, cl += cs 70 | bx := NumGet(gi, 48), by := NumGet(gi, 16, "Int") - NumGet(gi, 8, "Int") - gih - NumGet(gi, 52) 71 | If cf = 1 72 | dw -= giw - gw, dh -= gih - gh 73 | NumPut(i, c, cb), NumPut(dx - bx, c, cb + 4, "Short"), NumPut(dy - by, c, cb + 6, "Short") 74 | , NumPut(dw, c, cb + 8, "Short"), NumPut(dh, c, cb + 10, "Short") 75 | Return, true 76 | } 77 | -------------------------------------------------------------------------------- /lib/ChangeProcessName.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 脚本启动后默认进程名为AutoHotkey.exe,改变之 3 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 4 | 5 | SMExe(file) 6 | { 7 | Loop, %file% 8 | Filename := RegExReplace(A_LoopFileName, "\.[^\.]*$") 9 | 10 | OrigAhk := A_AhkPath 11 | SplitPath, OrigAhk, , DumpAhk 12 | DumpAhk .= "\" 13 | DumpAhk .= "AutoHotkeyDump.exe" 14 | 15 | if (!FileExist(DumpAhk)) 16 | FileCopy, %OrigAhk%, %DumpAhk% 17 | 18 | Loop, %DumpAhk% 19 | path := A_LoopFileDir 20 | 21 | FileMove, %DumpAhk%, %path%\%FileName%.exe 22 | If ErrorLevel 23 | Return ErrorLevel 24 | 25 | Loop 26 | Loop, %path%\%FileName%.exe 27 | { 28 | Run, %A_LoopFileFullPath% "%file%", % RegExReplace(file, "\\[^\\]*$"), , PID 29 | Process, Wait, %PID%, 10 30 | FileMove, %A_LoopFileFullPath%, %DumpAhk% 31 | Process, Wait, %PID%, 0.1 32 | Return ErrorLevel 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/DpiScale.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 获取当前DPI和默认DPI(96)的比值,以便于某些UI程序调整位置、字体等 3 | ; 当设置字体为"中等(M)-125%"时,实际上是设置DPI为120,120/96=1.25 4 | ; 5 | ; gaochao.morgen@gmail.com 6 | ; 2015/12/22 7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 8 | 9 | GetDpiScale() 10 | { 11 | ; 当前DPI 12 | RegRead, AppliedDPI, HKEY_CURRENT_USER, Control Panel\Desktop\WindowMetrics, AppliedDPI 13 | ; 默认DPI 14 | RegRead, LogPixels, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontDPI, LogPixels 15 | 16 | Return AppliedDPI/LogPixels 17 | } 18 | 19 | -------------------------------------------------------------------------------- /lib/HexDec.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 十六进制与十进制互相转换 3 | ; 4 | ; gaochao.morgen@gmail.com 5 | ; 2017/3/13 6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 | 8 | ; 十进制转换为十六进制的函数 9 | ; @param d 十进制数整数 10 | ; @return 十六进制数,以0x打头 11 | Dec2Hex(d) 12 | { 13 | SetFormat, integer, hex 14 | h := d+0 15 | h = %h% 16 | SetFormat, integer, dec ; 恢复至正常的10进制计算习惯 17 | Return %h% 18 | } 19 | 20 | ; 十六进制转换为十进制的函数 21 | ; @param h 十六进制数整数,以0x打头 22 | ; @return 十进制数 23 | Hex2Dec(h) 24 | { 25 | SetFormat, integer, dec 26 | d := h+0 27 | d = %d% 28 | SetFormat, integer, hex 29 | Return %d% 30 | } 31 | 32 | -------------------------------------------------------------------------------- /lib/IEAttach.ahk: -------------------------------------------------------------------------------- 1 | ; 名称: IEAttach() 2 | ; 作者: amnesiac 3 | ; 用途: 4 | ; 根据选择的匹配模式, 附加到指定的 InternetExplorer 或 WebBrowser 对象. 5 | ; 6 | ; 参数: 7 | ; s_string [可选参数] 要搜索的字符串 (对于"embedded"或者"dialogbox", 使用标题子字符串或者窗口句柄) 8 | ; s_mode [可选参数]: 指定搜索模式 9 | ; Title = (默认) 主文档标题的子字符串 10 | ; WindowTitle = 完整窗口标题的子字符串(替代文档标题) 11 | ; URL = 当前网页的url或者url子字符串 12 | ; Text = 当前网页body标记内的文本或者文本子字符串 13 | ; HTML = 当前网页body标签内的HTML代码或者HTML代码子字符串 14 | ; HWND = 浏览器窗口句柄 15 | ; Embedded = 嵌入了控件的窗口的句柄或者标题子字符串 16 | ; DialogBox = 模态/非模态的对话框的句柄或者标题子字符串 17 | ; Instance = 忽略 s_string, 从所有可用的浏览器实例中返回一个浏览器引用(通过匹配实例号) 18 | ; i_instance [可选参数]: 按照 $s_string 和 $s_mode 匹配的浏览器组/嵌入式浏览器组返回一个基于1开始的索引数组. 参考备注. 19 | ; 返回值 20 | ; 成功: 返回一个指向 InternetExplorer 对象的变量,嵌入式浏览器与对话框模块将返回一个窗口对象 21 | ; 失败: 没有返回值 22 | ; 注意事项 23 | ; 1. 这个函数提供了通过 "dialogbox" 附加到由浏览器创建的模式/非模式对话框的功能, 需要注意并非由浏览器创建的所有对话框都可以进行控制, 24 | ; 许多这种对话框是标准的 Windows 窗口, 应该使用普通的窗口控制函数进行操作. 要区分这两种窗口可以用 Active Window Info 工具, 25 | ; 如果窗口中含有类名为 Internet Explorer_Server 的控件, 那么可以用这种方法进行附加, 否则需要用普通的窗口控制函数. 26 | ; 2. 此函数可能返回 WebBrowser 或 InternetExplorer 对象, 需要注意它们的区别. 如果通过 WebBrowser 对象访问状态栏/地址栏文本, 则可能出现错误. 27 | 28 | IEAttach(s_string = "", s_mode = "Title", i_instance = 1) 29 | { 30 | If (s_mode = "embedded" Or s_mode = "dialogbox") 31 | { 32 | iWinTitleMatchMode := A_TitleMatchMode 33 | SetTitleMatchMode, 2 34 | if s_string is xdigit ; 这里有更好的方法判断是否为句柄吗? 这里需要用更好的方法判断是否为句柄, 否则空字符串也会被视为十六进制数 35 | { 36 | i_instance := 1 37 | } 38 | Else 39 | { 40 | WinGet, aWinList, List, %s_string% 41 | Loop, %aWinList% 42 | { 43 | hWin := aWinList%A_Index% 44 | WinGet, sCtrlList, ControlList, ahk_id %hWin% 45 | Loop, Parse, sCtrlList, `n 46 | { 47 | if (A_LoopField = "Internet Explorer_Server" i_instance) 48 | { 49 | s_string := hWin 50 | break, 2 51 | } 52 | } 53 | } 54 | } 55 | ControlGet, hIECtrl, hwnd, , Internet Explorer_Server%i_instance%, ahk_id %s_string% 56 | oResult := _IEObjGetFromHwnd(hIECtrl) 57 | SetTitleMatchMode, %iWinTitleMatchMode% 58 | If IsObject(oResult) 59 | Return, oResult 60 | Else 61 | Return 62 | } 63 | if (s_mode = "hwnd") 64 | i_instance := 1 65 | oIECtrlSet := _IEHwndGetFromClassNN(i_instance) 66 | if !oIECtrlSet 67 | return 68 | for nIndex, hIECtrl in oIECtrlSet 69 | { 70 | oIE := _IEObjGetFromHwnd(hIECtrl) 71 | if (s_mode = "title") 72 | { 73 | If InStr(oIE.document.title, s_string) > 0 74 | { 75 | return, oIE 76 | } 77 | } 78 | else if (s_mode = "instance") 79 | { 80 | return, oIE 81 | } 82 | else if (s_mode = "windowtitle") 83 | { 84 | RegRead, sTemp, HKEY_CURRENT_USER, Software\Microsoft\Internet Explorer\Main\, Window Title 85 | If !ErrorLevel 86 | { 87 | If InStr(oIE.document.title " - " sTemp, s_string) 88 | return, oIE 89 | } 90 | Else 91 | { 92 | If InStr(oIE.document.title " - Microsoft Internet Explorer", s_string) or InStr(oIE.document.title " - Windows Internet Explorer", s_string) 93 | return, oIE 94 | } 95 | } 96 | else if (s_mode = "url") 97 | { 98 | If InStr(oIE.LocationURL, s_string) > 0 99 | { 100 | return, oIE 101 | } 102 | } 103 | else if (s_mode = "text") 104 | { 105 | If InStr(oIE.document.body.innerText, s_string) > 0 106 | { 107 | return, oIE 108 | } 109 | } 110 | else if (s_mode = "html") 111 | { 112 | If InStr(oIE.document.body.innerHTML, s_string) > 0 113 | { 114 | return, oIE 115 | } 116 | } 117 | else if (s_mode = "hwnd") 118 | { 119 | If (oIE.hwnd() = s_string) ; 可能存在问题 120 | Return, oIE 121 | } 122 | } 123 | return 124 | } 125 | 126 | ; 内部函数: 根据 WebBrowser 控件的 ClassNN (即 Internet Explorer_Server 加上数字)获取当前存在的所有这种控件的 ID 127 | _IEHwndGetFromClassNN(i_instance = 1) 128 | { 129 | WinGet, aWinList, List, ahk_class IEFrame 130 | if (aWinList = 0) 131 | return 132 | oIECtrlSet := Object() 133 | Loop, %aWinList% 134 | { 135 | hWin := aWinList%A_Index% 136 | WinGet, sCtrlList, ControlList, ahk_id %hWin% 137 | Loop, Parse, sCtrlList, `n 138 | { 139 | if (A_LoopField = "Internet Explorer_Server" i_instance) 140 | { 141 | ControlGet, hCtrl, Hwnd,, Internet Explorer_Server%i_instance%, ahk_id %hWin% 142 | oIECtrlSet.Insert(hCtrl) 143 | } 144 | } 145 | } 146 | return, oIECtrlSet.MaxIndex()="" ? "" : oIECtrlSet 147 | } 148 | 149 | ; 内部函数: 根据 WebBrowser 控件的句柄,获取它所在的 WebBrowser 对象 150 | _IEObjGetFromHwnd(h_IECtrl) 151 | { 152 | static Msg := DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT") 153 | SendMessage, Msg, 0, 0, , ahk_id %h_IECtrl% 154 | if (ErrorLevel = "FAIL") 155 | return 156 | lResult := ErrorLevel 157 | VarSetCapacity(GUID, 16, 0) 158 | GUID := IID_IHTMLDocument2 ; 这里 IID_IHTMLDocument2 不是个变量,为什么不会出错呢? 159 | sGUID := "{332C4425-26CB-11D0-B483-00C04FD90119}" 160 | CLSID := DllCall("ole32\CLSIDFromString", "wstr", sGUID, "ptr", &GUID) >= 0 ? &GUID : "" 161 | DllCall("oleacc\ObjectFromLresult", "ptr", lResult, "ptr", CLSID, "ptr", 0, "ptr*", pDoc) 162 | static IID_IWebBrowserApp := "{0002DF05-0000-0000-C000-000000000046}" 163 | static SID_SWebBrowserApp := IID_IWebBrowserApp 164 | pWeb := ComObjQuery(pDoc, SID_SWebBrowserApp, IID_IWebBrowserApp) 165 | ObjRelease(pDoc) 166 | static VT_DISPATCH := 9, F_OWNVALUE := 1 167 | oIE := ComObjParameter(VT_DISPATCH, pWeb, F_OWNVALUE) 168 | return, oIE 169 | } 170 | -------------------------------------------------------------------------------- /lib/InsertionSort.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 对array进行排序,采用插入排序法 3 | ; 要求array参数的值必须通过Array.Insert()插入 4 | ; 曾经尝试过在函数中直接对array参数进行Remove(),但是未成功,因此改为新建一个Array,最后再赋值给array参数 5 | ; 6 | ; gaochao.morgen@gmail.com 7 | ; 2014/2/9 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | 10 | InsertionSort(ByRef array) 11 | { 12 | target := Array() 13 | 14 | count := 0 15 | for Index, Files in array 16 | { 17 | files%Index% := Files 18 | count += 1 19 | } 20 | 21 | j := 2 22 | while (j <= count) 23 | { 24 | key := files%j% 25 | i := j-1 26 | 27 | while (i >= 0 && key < files%i%) 28 | { 29 | k := i+1 30 | files%k% := files%i% 31 | i -= 1 32 | } 33 | 34 | k := i+1 35 | files%k% := key 36 | j += 1 37 | } 38 | 39 | Loop, %count% 40 | { 41 | target.Insert(files%A_Index%) 42 | } 43 | 44 | array := target 45 | } 46 | 47 | -------------------------------------------------------------------------------- /lib/StdoutToVar.ahk: -------------------------------------------------------------------------------- 1 | ; 执行命令sCmd,并且把命令输出从stdout导入变量 2 | ; source: http://www.autohotkey.com/forum/viewtopic.php?p=509873#509873 3 | StdoutToVar_CreateProcess(sCmd, bStream="", sDir="", sInput="") 4 | { 5 | bStream= ; not implemented 6 | sDir= ; not implemented 7 | sInput= ; not implemented 8 | 9 | DllCall("CreatePipe", "Ptr*", hStdInRd , "Ptr*", hStdInWr , "Uint", 0, "Uint", 0) 10 | DllCall("CreatePipe", "Ptr*", hStdOutRd, "Ptr*", hStdOutWr, "Uint", 0, "Uint", 0) 11 | DllCall("SetHandleInformation", "Ptr", hStdInRd , "Uint", 1, "Uint", 1) 12 | DllCall("SetHandleInformation", "Ptr", hStdOutWr, "Uint", 1, "Uint", 1) 13 | 14 | ; Fill a StartupInfo structure 15 | if A_PtrSize = 4 ; We're on a 32-bit system. 16 | { 17 | VarSetCapacity(pi, 16, 0) 18 | sisize := VarSetCapacity(si, 68, 0) 19 | NumPut(sisize, si, 0, "UInt") 20 | NumPut(0x100, si, 44, "UInt") 21 | NumPut(hStdInRd , si, 56, "Ptr") ; stdin 22 | NumPut(hStdOutWr, si, 60, "Ptr") ; stdout 23 | NumPut(hStdOutWr, si, 64, "Ptr") ; stderr 24 | } 25 | else if A_PtrSize = 8 ; We're on a 64-bit system. 26 | { 27 | VarSetCapacity(pi, 24, 0) 28 | sisize := VarSetCapacity(si, 96, 0) 29 | NumPut(sisize, si, 0, "UInt") 30 | NumPut(0x100, si, 60, "UInt") 31 | NumPut(hStdInRd , si, 80, "Ptr") ; stdin 32 | NumPut(hStdOutWr, si, 88, "Ptr") ; stdout 33 | NumPut(hStdOutWr, si, 96, "Ptr") ; stderr 34 | } 35 | 36 | DllCall("CreateProcess", "Uint", 0 ; Application Name 37 | , "Ptr", &sCmd ; Command Line 38 | , "Uint", 0 ; Process Attributes 39 | , "Uint", 0 ; Thread Attributes 40 | , "Int", True ; Inherit Handles 41 | , "Uint", 0x08000000 ; Creation Flags (0x08000000 = Suppress console window) 42 | , "Uint", 0 ; Environment 43 | , "Uint", 0 ; Current Directory 44 | , "Ptr", &si ; Startup Info 45 | , "Ptr", &pi) ; Process Information 46 | 47 | DllCall("CloseHandle", "Ptr", NumGet(pi, 0)) 48 | DllCall("CloseHandle", "Ptr", NumGet(pi, A_PtrSize)) 49 | DllCall("CloseHandle", "Ptr", hStdOutWr) 50 | DllCall("CloseHandle", "Ptr", hStdInRd) 51 | DllCall("CloseHandle", "Ptr", hStdInWr) 52 | 53 | VarSetCapacity(sTemp, 4095) 54 | nSize := 0 55 | loop 56 | { 57 | result := DllCall("Kernel32.dll\ReadFile", "Uint", hStdOutRd, "Ptr", &sTemp, "Uint", 4095, "UintP", nSize, "Uint", 0) 58 | if (result = "0") 59 | break 60 | else 61 | sOutput := sOutput . StrGet(&sTemp, nSize, "CP850") 62 | } 63 | 64 | DllCall("CloseHandle", "Ptr", hStdOutRd) 65 | return, sOutput 66 | } 67 | 68 | -------------------------------------------------------------------------------- /lib/SystemCursor.ahk: -------------------------------------------------------------------------------- 1 | ; 此脚本来自 www.autohotkey.com/forum/topic6107.html 2 | 3 | SystemCursor(OnOff=1) ; 初始化 = "I","Init"; 隐藏 = 0,"Off"; 切换 = -1,"T","Toggle"; 显示 = 其他 4 | { 5 | static AndMask, XorMask, $, h_cursor 6 | ,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 ; 系统指针 7 | , b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13 ; 空白指针 8 | , h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13 ; 默认指针的句柄 9 | if (OnOff = "Init" or OnOff = "I" or $ = "") ; 在请求或首此调用时进行初始化 10 | { 11 | $ = h ; 活动的默认指针 12 | VarSetCapacity( h_cursor,4444, 1 ) 13 | VarSetCapacity( AndMask, 32*4, 0xFF ) 14 | VarSetCapacity( XorMask, 32*4, 0 ) 15 | system_cursors = 32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650 16 | StringSplit c, system_cursors, `, 17 | Loop %c0% 18 | { 19 | h_cursor := DllCall( "LoadCursor", "Ptr",0, "Ptr",c%A_Index% ) 20 | h%A_Index% := DllCall( "CopyImage", "Ptr",h_cursor, "UInt",2, "Int",0, "Int",0, "UInt",0 ) 21 | b%A_Index% := DllCall( "CreateCursor", "Ptr",0, "Int",0, "Int",0 22 | , "Int",32, "Int",32, "Ptr",&AndMask, "Ptr",&XorMask ) 23 | } 24 | } 25 | if (OnOff = 0 or OnOff = "Off" or $ = "h" and (OnOff < 0 or OnOff = "Toggle" or OnOff = "T")) 26 | $ = b ; 使用空白指针 27 | else 28 | $ = h ; 使用保存的指针 29 | 30 | Loop %c0% 31 | { 32 | h_cursor := DllCall( "CopyImage", "Ptr",%$%%A_Index%, "UInt",2, "Int",0, "Int",0, "UInt",0 ) 33 | DllCall( "SetSystemCursor", "Ptr",h_cursor, "UInt",c%A_Index% ) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/Taskbar.ahk: -------------------------------------------------------------------------------- 1 | /* Title: Taskbar 2 | *Taskbar monitor and controller* 3 | : 4 | Using this module you can monitor and control Windows Taskbar buttons. 5 | Your script can get information about windows currently displayed in Taskbar 6 | as well as hide, delete or move its buttons. 7 | */ 8 | 9 | /* 10 | Function: Count 11 | Get the number of buttons in the Taskbar. 12 | 13 | Returns: 14 | Number. This includes hidden buttons. 15 | */ 16 | 17 | Taskbar_Count() { 18 | static TB_BUTTONCOUNT=0x418 19 | h := Taskbar_GetHandle() 20 | SendMessage,TB_BUTTONCOUNT,,,,ahk_id %h% 21 | return ErrorLevel 22 | } 23 | 24 | 25 | /* Function: Define 26 | Get information about Taskbar buttons. 27 | 28 | Parameters: 29 | Filter - Contains process name, ahk_pid, ahk_id or 1-based position for which to return information. 30 | If you specify position as Filter, you can use output variables to store information since only 1 item 31 | will be returned in that case. If you omit this parameter, information about all buttons will be returned. 32 | pQ - Query parameter, by default "iwt". 33 | o1..o7 - Reference to output variables. 34 | 35 | Query: 36 | h - Handle. 37 | i - PosItion (1 based). 38 | w - Parent Window handle. 39 | p - Process Pid. 40 | n - Process Name. 41 | o - IcOn handle. 42 | t - Title of the parent window. 43 | 44 | Returns: 45 | String containing icon information per line. 46 | */ 47 | Taskbar_Define(Filter="", pQ="", ByRef o1="~`a", ByRef o2="", ByRef o3="", ByRef o4="", ByRef o5="", ByRef o6="", ByRef o7=""){ 48 | static TB_BUTTONCOUNT = 0x418, TB_GETBUTTON=0x417, sep="|" 49 | ifEqual, pQ,, SetEnv, pQ, iwt 50 | 51 | if Filter is integer 52 | bPos := Filter 53 | else if Filter contains ahk_pid,ahk_id 54 | bPid := InStr(Filter, "ahk_pid"), bID := !bPid, Filter := SubStr(Filter, 8) 55 | else bName := true 56 | 57 | oldDetect := A_DetectHiddenWindows 58 | DetectHiddenWindows, on 59 | 60 | WinGet, pidTaskbar, PID, ahk_class Shell_TrayWnd 61 | hProc := DllCall("OpenProcess", "Uint", 0x38, "int", 0, "Uint", pidTaskbar) 62 | pProc := DllCall("VirtualAllocEx", "Uint", hProc, "Uint", 0, "Uint", 32, "Uint", 0x1000, "Uint", 0x4) 63 | hctrl := Taskbar_GetHandle() 64 | SendMessage,TB_BUTTONCOUNT,,,, ahk_id %hctrl% 65 | 66 | i := bPos ? bPos-1 : 0 67 | cnt := bPos ? 1 : ErrorLevel 68 | Loop, %cnt% 69 | { 70 | i++ 71 | SendMessage, TB_GETBUTTON, i-1, pProc,, ahk_id %hctrl% 72 | 73 | VarSetCapacity(BTN,32), DllCall("ReadProcessMemory", "Uint", hProc, "Uint", pProc, "Uint", &BTN, "Uint", 32, "Uint", 0) 74 | if !(dwData := NumGet(BTN,12)) 75 | dwData := NumGet(BTN,16,"int64") 76 | 77 | h := NumGet(BTN, 4) 78 | 79 | VarSetCapacity(NFO,32), DllCall("ReadProcessMemory", "Uint", hProc, "Uint", dwData, "Uint", &NFO, "Uint", 32, "Uint", 0) 80 | if NumGet(BTN,12) 81 | w := NumGet(NFO, 0), o := NumGet(NFO, 20) 82 | else w := NumGet(NFO, 0, "int64"), o := NumGet(NFO, 24) 83 | ifEqual, w, 0, continue 84 | 85 | WinGet, n, ProcessName, ahk_id %w% 86 | WinGet, p, PID, ahk_id %w% 87 | WinGetTitle, t, ahk_id %w% 88 | 89 | if !Filter || bPos || (bName && Filter=n) || (bPid && Filter=p) || (bId && Filter=w) { 90 | loop, parse, pQ 91 | f := A_LoopField, res .= %f% sep 92 | res := SubStr(res, 1, -1) "`n" 93 | } 94 | } 95 | DllCall("VirtualFreeEx", "Uint", hProc, "Uint", pProc, "Uint", 0, "Uint", 0x8000), DllCall("CloseHandle", "Uint", hProc) 96 | 97 | if (bPos) 98 | loop, parse, pQ 99 | o%A_Index% := %A_LoopField% 100 | 101 | DetectHiddenWindows, %oldDetect% 102 | return SubStr(res, 1, -1) 103 | } 104 | 105 | /* 106 | Function: Flash 107 | Flash the Taskbar button. 108 | 109 | Parameters: 110 | Hwnd - Hwnd of the window to flash. 111 | Options - White space separated list of flash options. 112 | 113 | Flash options: 114 | Caption - Flash caption. 115 | Button - Flash button. This is default option. 116 | All - Flash both. 117 | Timer - Flesh until next call of this function with empty Options argument. 118 | TimerFG - Flash continuously until the window comes to the foreground. 119 | N.R - Decimal number. N specifies number of times to flash, by defult 3, R the flash rate (0 means cursor rate, default). 120 | 121 | Returns: 122 | The return value specifies the window's state before the call to the Flash function. 123 | If the window caption was drawn as active before the call, the return value is nonzero. 124 | Otherwise, the return value is zero. 125 | 126 | Example: 127 | > Taskbar_Flash( Taskbar_Define(2, "w"), "10.200 button") ;flash first button 10 times with 200ms rate, only button 128 | */ 129 | Taskbar_Flash( Hwnd=0, Options="" ) { 130 | static STOP=0, CAPTION=1, BUTTON=2, ALL=3, TIMER=4, TIMERFG=12 131 | 132 | cnt := 0, rate := 0, hFlags := 0 133 | loop, parse, Options, %A_Space%%A_Tab%,%A_Space%%A_Tab% 134 | { 135 | ifEqual, A_LoopField,,continue 136 | if A_LoopField is number 137 | cnt := floor(A_LoopField), rate := (j:=InStr(A_LoopField, ".")) ? SubStr(A_LoopField, j+1) : 0 138 | else hFlags |= %A_LoopField% 139 | } 140 | ifEqual, hFlags, , return A_ThisFunc ">Some of the options are invalid: " Options 141 | VarSetCapacity(FW, 20), NumPut(20,FW), NumPut(Hwnd,FW,4), NumPut(4,FW,8), NumPut(cnt,FW,12), NumPut(rate,FW,16) 142 | Return DllCall( "FlashWindowEx", "UInt", &FW ) 143 | } 144 | 145 | /* 146 | Function: Focus 147 | Focus the Taskbar. 148 | 149 | Remarks: 150 | After the Taskbar is focused, you can use {Space} or {Enter} to activate window or 151 | windows popup button to display system menu. 152 | */ 153 | Taskbar_Focus() { 154 | h := Taskbar_GetHandle() 155 | ControlFocus,,ahk_id %h% ;this is OK but pressing TAB doesn't move to tray, but returns back to quickl. 156 | } 157 | 158 | /* 159 | Function: Disable 160 | Disable the Taskbar. 161 | 162 | Parameters: 163 | bDisable - Set to FALSE to enable Taskbar. By default TRUE. 164 | */ 165 | Taskbar_Disable(bDisable=true){ 166 | tid := Taskbar_GetHandle() 167 | if bDisable 168 | WinHide, ahk_id %tid% 169 | else WinShow, ahk_id %tid% 170 | } 171 | 172 | /* 173 | Function: GetHandle 174 | Get the Hwnd of the Taskbar. 175 | 176 | Returns: 177 | Hwnd 178 | */ 179 | Taskbar_GetHandle(){ 180 | ControlGet, hParent, HWND,,MSTaskSwWClass1, ahk_class Shell_TrayWnd 181 | ControlGet, h, HWND,, ToolbarWindow321, ahk_id %hParent% 182 | return h 183 | } 184 | 185 | /* Function: GetRect 186 | Get Taskbar button placement. 187 | 188 | Parameters: 189 | Position - Position of the button. Use negative position to retreive client coordinates. 190 | X..H - Refrence to output variables, optional. 191 | 192 | Returns: 193 | String containing all outuput variables. 194 | 195 | Remarks: 196 | This function can be used to determine invisible buttons. Such buttons will have w & h equal to 0. 197 | */ 198 | Taskbar_GetRect( Position, ByRef X="", ByRef Y="", ByRef W="", ByRef H="" ) { 199 | static TB_GETITEMRECT := 0x41D 200 | oldDetect := A_DetectHiddenWindows 201 | DetectHiddenWindows, on 202 | 203 | If (Position < 0) 204 | Position := -Position, bClient := true 205 | 206 | tid := Taskbar_GetHandle() 207 | WinGetPos, xp, yp,,,ahk_id %tid% 208 | VarSetCapacity(RECT, 16) 209 | 210 | WinGet, pidTaskbar, PID, ahk_id %tid% 211 | hProc := DllCall("OpenProcess", "Uint", 0x38, "int", 0, "Uint", pidTaskbar) 212 | pProc := DllCall("VirtualAllocEx", "Uint", hProc, "Uint", 0, "Uint", 16, "Uint", 0x1000, "Uint", 0x4) 213 | 214 | SendMessage, TB_GETITEMRECT, Position-1, pProc,,ahk_id %tid% 215 | DllCall("ReadProcessMemory", "Uint", hProc, "Uint", pProc, "Uint", &RECT, "Uint", 16, "Uint", 0) 216 | X := NumGet(RECT, 0, "Int"), Y := NumGet(RECT, 4, "Int"), W := NumGet(RECT, 8, "Int")-X, H := NumGet(RECT, 12, "Int") - Y 217 | if !bClient 218 | X+=xp, Y+=yp 219 | 220 | DetectHiddenWindows, %oldDetect% 221 | return X " " Y " " W " " H 222 | } 223 | 224 | /* 225 | Function: Hide 226 | Hide Taskbar button. 227 | 228 | Parameters: 229 | Position - Position of the button. 230 | bHide - Set to TRUE (default) to hide button. FALSE will show it again. 231 | 232 | Returns: 233 | TRUE if successful, or FALSE otherwise. 234 | */ 235 | 236 | Taskbar_Hide(Handle, bHide=True){ 237 | static TB_HIDEBUTTON=0x404 238 | h := Taskbar_GetHandle() 239 | SendMessage, TB_HIDEBUTTON, Handle, bHide,,ahk_id %h% 240 | return ErrorLevel 241 | } 242 | 243 | /* 244 | Function: Move 245 | Move Taskbar button. 246 | 247 | Parameters: 248 | Pos - 1-based position of the button to be moved. 249 | NewPos - 1-based postiion where the button will be moved. 250 | 251 | Returns: 252 | TRUE indicates success. FALSE indicates failure. 253 | 254 | Remarks: 255 | When moving a button this function will also move its hidden button. 256 | */ 257 | Taskbar_Move(Pos, NewPos){ 258 | static TB_MOVEBUTTON=0x452 259 | h := Taskbar_GetHandle() 260 | if (NewPos < Pos) { 261 | SendMessage, TB_MOVEBUTTON,Pos-2, NewPos-2,, ahk_id %h% 262 | SendMessage, TB_MOVEBUTTON,Pos-1, NewPos-1,, ahk_id %h% 263 | } else if (NewPos > Pos){ 264 | SendMessage, TB_MOVEBUTTON,Pos-1, NewPos-1,, ahk_id %h% 265 | SendMessage, TB_MOVEBUTTON,Pos-2, NewPos-2,, ahk_id %h% 266 | } else return 1 267 | return ErrorLevel 268 | } 269 | 270 | /* 271 | Function: Remove 272 | Remove Taskbar button. 273 | 274 | Parameters: 275 | Position - Position of the button. 276 | 277 | Returns: 278 | TRUE indicates success. FALSE indicates failure. 279 | */ 280 | 281 | Taskbar_Remove(Position){ 282 | static TB_DELETEBUTTON=0x416 283 | h := Taskbar_GetHandle() 284 | SendMessage, TB_DELETEBUTTON,Position-1,,,ahk_id %h% 285 | return ErrorLevel 286 | } 287 | 288 | /* Group: Example 289 | 290 | Sort buttons on the Taskbar: 291 | 292 | (start code) 293 | ;requires that there are no grouped buttons 294 | SortTaskbar(type="R") { 295 | static WM_SETREDRAW=0xB 296 | h := Taskbar_GetHandle() 297 | SendMessage, WM_SETREDRAW, 0, , , ahk_id %h% 298 | loop, % Taskbar_Count() // 2 299 | { 300 | s := btns := Taskbar_Define("", "ti") "`n" 301 | Sort, s, %type% 302 | s := RegExReplace( s, "([^\n]*+\n){" A_Index-1 "}", "", "", 1 ) 303 | s := SubStr(s, 1, InStr(S, "`n")-1) 304 | StringSplit, w, s, | 305 | 306 | Taskbar_Move( w2, 2 ) 307 | } 308 | SendMessage, WM_SETREDRAW, 1, , , ahk_id %h% 309 | } 310 | (end code) 311 | */ 312 | 313 | /* Group: About 314 | o v1.0 by majkinetor. 315 | o Parts of code by Sean. See . 316 | o Licenced under GNU GPL . 317 | */ 318 | -------------------------------------------------------------------------------- /resources/Cmd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/resources/Cmd.png -------------------------------------------------------------------------------- /resources/IE.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/resources/IE.ico -------------------------------------------------------------------------------- /resources/JPG .ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/resources/JPG .ico -------------------------------------------------------------------------------- /resources/ahk.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/resources/ahk.ico -------------------------------------------------------------------------------- /scripts/!AHK帮助.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 一键启动AHK帮助文件,并检索剪切板中的内容 3 | ; 注意: 跟使用的AutoHotkey.chm有关系,不同版本的chm可能搜索框的classNN不同 4 | ; 我所使用的是: http://sourceforge.net/projects/ahkcn/ 5 | ; 版本为: v1.1.13.01 6 | ; 7 | ; Alt + H: 在AHK帮助文件中查找剪切板内容 8 | ; 9 | ; gaochao.morgen@gmail.com 10 | ; 2014/2/4 11 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 12 | 13 | #SingleInstance Force ; 跳过对话框并自动替换旧实例 14 | #NoTrayIcon ; 不显示托盘图标 15 | #NoEnv ; 不检查空变量是否为环境变量(建议所有新脚本使用) 16 | 17 | ; Alt + H 18 | !h:: 19 | IfWinExist, ahk_class HH Parent 20 | { 21 | WinActivate ; 自动使用上面找到的窗口. 22 | WinMaximize ; 同上 23 | Sleep, 200 24 | } 25 | else 26 | { 27 | Run, %ProgramFiles%\AutoHotkey\AutoHotkey.chm,, Max 28 | Sleep, 700 29 | WinActivate 30 | } 31 | 32 | Send !n ; Alt+N 切换到索引标签,并且焦点会自动聚焦到Edit控件上 33 | ControlGetFocus, CtrlName ; 获取Edit控件名称 34 | ControlSetText, %CtrlName%, %ClipBoard%, ahk_class HH Parent ; 设置搜索框内容 35 | Send {Enter} ; 回车确认检索 36 | 37 | Return 38 | 39 | -------------------------------------------------------------------------------- /scripts/+01.办公软件.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 一键启动办公必备程序 3 | ; 需要人为指定第几秒启动哪个程序 4 | ; 5 | ; gaochao.morgen@gmail.com 6 | ; 2013/7/2 7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 8 | 9 | #SingleInstance Force 10 | #NoEnv 11 | 12 | ; 设置 ErrorLevel 为这个正在运行脚本的 PID 13 | Process, Exist 14 | 15 | ExeList := Object() 16 | 17 | ; 采用Object.Insert(Index, Value)的方式,Index表示第几秒启动,Value表示程序 18 | ExeList.Insert(0, "E:\DeskWidget\DeskWidget.exe") 19 | ExeList.Insert(5, "C:\Program Files\Tencent\QQ\QQProtect\Bin\QQProtect.exe") 20 | ExeList.Insert(15, "C:\Program Files\Microsoft Office Communicator\communicator.exe") 21 | ExeList.Insert(20, "C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE") 22 | ExeList.Insert(25, "C:\Program Files\DeskTask\DeskTask.exe") 23 | 24 | ; 采用Object.Insert(Key, Value)的方式,将会按照Key排序,不会按照我设定的顺序启动 25 | /* 26 | ExeList.Insert("E:\DeskWidget\DeskWidget.exe", 2) 27 | ExeList.Insert("C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE", 4) 28 | ExeList.Insert("C:\Program Files\DeskTask\DeskTask.exe", 5) 29 | ExeList.Insert("C:\Program Files\Microsoft Office Communicator\communicator.exe", 30) 30 | ExeList.Insert("C:\Program Files\Tencent\QQ\QQProtect\Bin\QQProtect.exe", 5) 31 | */ 32 | 33 | Delay := 0 34 | Elapse := 0 35 | 36 | for Seconds, Target in ExeList 37 | { 38 | Delay := (Seconds - Elapse) * 1000 39 | SplitPath, Target, ProcName 40 | 41 | CoordMode, ToolTip, Screen ; 把ToolTips放置在相对于屏幕坐标的位置 42 | ToolTip, Launching %ProcName%, (A_ScreenWidth/2-100), A_ScreenHeight/2 43 | Sleep, 1000 44 | 45 | ; 若进程未启动则启动,若已启动则不作任何改动 46 | Process, Exist, %ProcName% 47 | if (ErrorLevel = 0) 48 | { 49 | Sleep, %Delay% 50 | Run, %Target% 51 | } 52 | 53 | Elapse := ((Seconds-1)>0)?Seconds:0 54 | } 55 | 56 | ExitApp 57 | 58 | -------------------------------------------------------------------------------- /scripts/+02.日常软件.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 一键启动日常必备程序 3 | ; 需要人为指定第几秒启动哪个程序 4 | ; 5 | ; gaochao.morgen@gmail.com 6 | ; 2013/7/2 7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 8 | 9 | #SingleInstance Force 10 | #NoEnv 11 | 12 | ; 设置 ErrorLevel 为这个正在运行脚本的 PID 13 | Process, Exist 14 | 15 | ExeList := Object() 16 | 17 | ; 采用Object.Insert(Index, Value)的方式,Index表示第几秒启动,Value表示程序 18 | ExeList.Insert(0, "E:\DeskWidget\DeskWidget.exe") 19 | ExeList.Insert(5, "C:\Program Files\Tencent\QQ\Bin\QQ.exe") 20 | 21 | Delay := 0 22 | Elapse := 0 23 | 24 | for Seconds, Target in ExeList 25 | { 26 | Delay := (Seconds - Elapse) * 1000 27 | SplitPath, Target, ProcName 28 | 29 | CoordMode, ToolTip, Screen ; 把ToolTips放置在相对于屏幕坐标的位置 30 | ToolTip, Launching %ProcName%, (A_ScreenWidth/2-100), A_ScreenHeight/2 31 | Sleep, 1000 32 | 33 | ; 若进程未启动则启动,若已启动则不作任何改动 34 | Process, Exist, %ProcName% 35 | if (ErrorLevel = 0) 36 | { 37 | Sleep, %Delay% 38 | Run, %Target% 39 | } 40 | 41 | Elapse := ((Seconds-1)>0)?Seconds:0 42 | } 43 | 44 | ExitApp 45 | 46 | -------------------------------------------------------------------------------- /scripts/+03.Oracle服务.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 双击快速启动/停止Oracle服务 3 | ; 4 | ; gaochao.morgen@gmail.com 5 | ; 2014/2/24 6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 | 8 | #Include ../lib/StdoutToVar.ahk 9 | 10 | #SingleInstance Force 11 | #NoTrayIcon 12 | #NoEnv 13 | 14 | Gui, Font,, Arial 15 | Gui, Font, s10 16 | Gui, Add, ListView, -Multi x2 y0 w350 h350 gFastOperate, Index|Service|Status 17 | 18 | ; 刷新ListView 19 | Gosub, REFRESH 20 | 21 | Gui, Show,, Oracle Service List 22 | Return 23 | 24 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 25 | 26 | ; 刷新ListView 27 | REFRESH: 28 | LV_Delete() ; 清空列表内容 29 | 30 | scCmd := "sc.exe queryex state= all" ; 获取所有服务的数据 31 | sc := StdoutToVar_CreateProcess(scCmd) ; 命令输出从stdout定向到变量中 32 | idx := 0 33 | pos := 0 34 | 35 | Loop, Parse, sc, `n, `r 36 | { 37 | If A_LoopField= 38 | Continue 39 | IfInString, A_LoopField, SERVICE_NAME: 40 | { 41 | StringGetPos, pos, A_LoopField, : 42 | pos+=1 43 | StringTrimLeft, service_name, A_LoopField, %pos% 44 | Continue 45 | } 46 | IfInString, A_LoopField, STATE : 47 | { 48 | StringGetPos, pos, A_LoopField, : 49 | pos+=6 50 | StringMid, state, A_LoopField, %pos%, 7 51 | StringLower, state, state, T 52 | IfInString, service_name, OracleService ; 过滤Oracle服务 53 | { 54 | idx++ 55 | LV_Add("", idx, service_name, state) 56 | } 57 | ;IfInString, service_name, OracleOraDb11g_home1TNSListener ; 过滤Listener 58 | IfInString, service_name, TNSListener ; 过滤Listener 59 | { 60 | idx++ 61 | LV_Add("", idx, service_name, state) 62 | } 63 | Continue 64 | } 65 | } 66 | 67 | LV_ModifyCol() ; 根据内容自动调整每列的大小 68 | Return 69 | 70 | ; 双击时快速切换服务状态(未启动则启动,已启动则关闭) 71 | FastOperate: 72 | if A_GuiEvent = DoubleClick 73 | { 74 | LV_GetText(SrvName, A_EventInfo, 2) ; 从第二个字段中获取文本. 75 | LV_GetText(SrvStatus, A_EventInfo, 3) ; 从第三个字段中获取文本. 76 | if (SrvStatus = "Running") 77 | { 78 | RunWait, cmd /c net stop %SrvName% 79 | Gosub, REFRESH 80 | } 81 | else 82 | { 83 | RunWait, cmd /c net start %SrvName% 84 | Gosub, REFRESH 85 | } 86 | } 87 | Return 88 | 89 | ; 当窗口关闭时, 自动退出脚本 90 | GuiClose: 91 | Gui, Destroy 92 | ExitApp 93 | -------------------------------------------------------------------------------- /scripts/+04.一键显隐.ahk: -------------------------------------------------------------------------------- 1 | ;------------------------------------------------------------------------ 2 | ; Show hidden folders and file extension in Windows XP 3 | ; 注意: 4 | ; 1. 事先确保Hidden=2,同时HideFileExt=1(或者Hidden=1,同时HideFileExt=0) 5 | ; 2. 要修改注册表以实现文件显隐、后缀显隐,因此需要关闭防火墙和杀毒软件才有效果. 6 | ;------------------------------------------------------------------------ 7 | ; User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] 8 | ; Value Name: Hidden 9 | ; Data Type: REG_DWORD (DWORD Value) 10 | ; Value Data: (1 = show hidden, 2 = do not show) 11 | ; 12 | ; User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] 13 | ; Value Name: HideFileExt 14 | ; Data Type: REG_DWORD (DWORD Value) 15 | ; Value Data: (0 = show hidden, 1 = do not show) 16 | ; 17 | 18 | #SingleInstance Force 19 | #NoEnv 20 | 21 | ; 文件夹显隐 22 | RegRead, ShowHidden_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden 23 | if ShowHidden_Status = 2 24 | RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1 25 | Else 26 | RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2 27 | 28 | ; 后缀名显隐 29 | RegRead, FileExt_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt 30 | If FileExt_Status = 1 31 | RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 0 32 | Else 33 | RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 1 34 | 35 | ; 获取指定窗口的类名 36 | WinGetClass, CabinetWClass 37 | 38 | ; 刷新desktop/explorer 39 | PostMessage, 0x111, 28931,,, A 40 | PostMessage, 0x111, 28931,,, ahk_class Progman 41 | 42 | ; 上述语句在win7中还不能自动刷新,必须模拟一下菜单动作 43 | if A_OSVersion in WIN_7, WIN_8 44 | { 45 | MouseClick, Right 46 | Sleep, 1 47 | Send, {Ctrl Down}e{Ctrl Up} 48 | } 49 | -------------------------------------------------------------------------------- /scripts/+05.清空剪切板.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 清空剪切板 3 | ; 4 | ; gaochao.morgen@gmail.com 5 | ; 2014/2/4 6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 | 8 | #SingleInstance Force 9 | #NoTrayIcon 10 | #NoEnv 11 | 12 | ClipBoard := 13 | 14 | -------------------------------------------------------------------------------- /scripts/+06.CMD目录.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 在CMD中快速进入指定目录 3 | ; 1. 如果当前窗口是"我的电脑",则进入当前路径 4 | ; 2. 如果不是,则进入剪切板中那个路径 5 | ; 6 | ; 注意: 打开cmd窗口后会自动输入命令,命令均是英文,因此需要设置默认输入语言为英文 7 | ; 8 | ; gaochao.morgen@gmail.com 9 | ; 2014/4/9 10 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 11 | 12 | TargetDir := ClipBoard 13 | 14 | ; 如果"我的电脑"窗口位于最前面,则在CMD中进入"我的电脑"那个路径 15 | IfWinActive, ahk_class CabinetWClass 16 | { 17 | if A_OSVersion in WIN_7, WIN_8 18 | { 19 | ; 因为Win7地址栏默认没有展开,所以Edit1的值默认是空的,取ToolbarWindow322代替 20 | ControlGetText, DirDesc, ToolbarWindow322, A 21 | pos := RegExMatch(DirDesc, "[^:]*: (.*)", Result) 22 | if (ErrorLevel = 0 && pos > 0) 23 | TargetDir := Result1 24 | } 25 | else ; WIN_VISTA, WIN_2003, WIN_XP, WIN_2000 26 | { 27 | ControlGetText, TargetDir, Edit1, A ; GuiControlGet始终不行 28 | } 29 | 30 | } 31 | 32 | SplitPath, TargetDir,,,,, OutDrive 33 | 34 | ; 优先启动Cmder,若未安装Cmder则启动cmd 35 | try { 36 | Run, Cmder.exe,, Max, pid 37 | Sleep, 1000 ; Cmder比cmd的启动速度慢很多,给它一定时间启动 38 | } 39 | catch 40 | { 41 | Run, cmd.exe,, Max, pid 42 | } 43 | 44 | BringWindowToFront(pid) 45 | 46 | /* 47 | Sleep, 100 48 | WinGet, hWnd, ID, ahk_class ConsoleWindowClass ; hWnd - cmd窗口的窗口句柄 49 | SetEnglishIME(hWnd) 50 | */ 51 | 52 | SendInput %OutDrive%{Enter} 53 | SendInput {Raw}cd %TargetDir% 54 | SendInput {Enter} 55 | SendInput clear{Enter} ; clear.cmd内容如下, 需要将clear.cmd放入PATH中. cls也可以直接用,但顶端一行空行无法清除 56 | 57 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 58 | ; clear.cmd ; 59 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 60 | ; @echo off 61 | ; cls %* 62 | 63 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 64 | ; 函数 ; 65 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 66 | 67 | ; 为指定窗口设置英文输入法 68 | ; @param hWnd 窗口句柄 69 | SetEnglishIME(hWnd) { 70 | DllCall("SendMessage", "UInt", hWnd, "UInt", "80", "UInt", "1", "UInt", (DllCall("LoadKeyboardLayout", "Str", "04090409", "UInt", "257"))) 71 | } 72 | 73 | ; 让指定进程的窗口置顶 74 | BringWindowToFront(pid) 75 | { 76 | WinSet, AlwaysOnTop, On, ahk_pid %pid% 77 | Sleep, 100 78 | WinSet, AlwaysOnTop, Off, ahk_pid %pid% 79 | } 80 | 81 | -------------------------------------------------------------------------------- /scripts/+07.服务.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 一键启动服务窗口 3 | ; 4 | ; gaochao.morgen@gmail.com 5 | ; 2014/2/4 6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 | 8 | #Include ../lib/SystemCursor.ahk 9 | 10 | #SingleInstance Force 11 | #NoTrayIcon 12 | #NoEnv 13 | 14 | OnExit, ShowCursor ; 确保到脚本退出时鼠标光标是显示的. 15 | 16 | Run, services.msc ; Max参数不能最大化 17 | Sleep, 800 18 | WinActivate, ahk_class MMCMainFrame 19 | Send {Alt Down}{Space}x ; 测试"!{Space}x"不行,只能让Alt按下 20 | Send {Alt Up} ; 再把Alt弹起 21 | SystemCursor("Off") 22 | ControlGetPos, X, Y,,, SysListView321, ahk_class MMCMainFrame ; 标题栏控件坐标 23 | MouseMove, % X+125, % Y+5 ; 控件分隔处 24 | Send {LButton 2} ; 双击,长度最大化 25 | ControlGetPos, X, Y,,, SysListView321, ahk_class MMCMainFrame 26 | MouseMove, % X+300, % Y+300 ; 内容区域 27 | Send {LButton} 28 | SystemCursor("On") 29 | Return 30 | 31 | ShowCursor: 32 | SystemCursor("On") 33 | ExitApp 34 | 35 | -------------------------------------------------------------------------------- /scripts/+08.竖列对齐.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 将输入文件按照列对齐方式重排,默认分隔符为: 空格, Tab, 逗号, 分号 3 | ; 对齐后的内容自动拷贝到剪切板中 4 | ; 5 | ; 支持的文本编码方式: ANSI, UTF-8, UTF-8+BOM, UTF-16 6 | ; 7 | ; 注意: 本程序用到了3rd/gawk.exe, 3rd/sed.exe, 3rd/cut.exe, 3rd/iconv.exe 8 | ; 9 | ; 输入文本的编码,是本脚本重点考虑的问题 10 | ; 一方面,AHK处理的外部文件,推荐ANSI和UTF-8+BOM,它处理UTF-8会有问题. 11 | ; 另一方面,Linux衍生命令处理外部文件推荐ANSI和UTF-8,它处理UTF-8+BOM会有问题. 12 | ; 13 | ; UTF-8上的复杂性,是因为Linux和Windows在对待UTF-8编码是否带BOM上存在分歧, 14 | ; 前者建议不带(因此对UTF-8支持很好)后者默认带BOM(因此对UTF-8+BOM支持很好). 15 | ; 16 | ; 基于此原因,无论输入文件采用何种编码,最后均试图转换成ANSI编码 17 | ; 这样一方面Linux衍生命令如gawk, iconv等均执行正常,而AHK脚本也工作正常 18 | ; 19 | ; gaochao.morgen@gmail.com 20 | ; 2014/3/14 21 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 22 | 23 | #SingleInstance Force 24 | #NoTrayIcon 25 | #NoEnv 26 | 27 | FileEncoding ; 脚本默认以ANSI编码处理外部文件 28 | 29 | INFILE := ; 输入文件,编码方式: ANSI, UTF-8, UTF-8+BOM, UTF-16 30 | ENCODING := ; 输入文件的编码方式 31 | 32 | ICONVOUTFILE := A_WorkingDir . "\iconvtmp.txt" ; ICONV处理后的文件,ANSI编码 33 | AWKOUTFILE := A_WorkingDir . "\awktmp.txt" ; AWK处理后的文件,ANSI编码 34 | SEDOUTFILE := A_WorkingDir . "\sedtmp.txt" ; SED处理后的文件,ANSI编码 35 | 36 | Gui, Add, Button, x6 y7 w80 h20 gSetAnsi, 修正乱码 37 | Gui, Add, Button, x506 y7 w60 h20 gAlignColumn, 对齐 38 | Gui, Add, Edit, x6 y37 w560 h330 vMyEdit, 直接拖动TXT文件到该界面上 39 | Gui, Add, StatusBar,, ANSI 40 | Gui, Show,, 文本竖列对齐 41 | Return 42 | 43 | ; 响应单个文件拖动事件 44 | GuiDropFiles: 45 | Loop, parse, A_GuiEvent, `n 46 | { 47 | INFILE := A_LoopField 48 | ENCODING := GetFileEncoding(INFILE) 49 | if (ENCODING == "UTF-8+BOM") 50 | { 51 | UTF8OUTFILE := A_WorkingDir . "\utf8tmp.txt" ; 临时文件,保存UTF-8+BOM文件截掉BOM标志后的内容 52 | 53 | ; cut命令有BUG 54 | ;CUTCMD := GenerateCutCommand(INFILE, UTF8OUTFILE) 55 | ;RunWait, cmd /c %CUTCMD%,, Hide 56 | 57 | RemoveUTF8BOM(INFILE, UTF8OUTFILE) 58 | 59 | ICONVCMD := GenerateIconvCommand("UTF-8", UTF8OUTFILE, ICONVOUTFILE) 60 | RunWait, cmd /c %ICONVCMD%,, Hide 61 | FileDelete, %UTF8OUTFILE% 62 | } else if (ENCODING == "UTF-16") { 63 | ICONVCMD := GenerateIconvCommand("UTF-16", INFILE, ICONVOUTFILE) 64 | RunWait, cmd /c %ICONVCMD%,, Hide 65 | } else { ; ANSI or UTF-8 66 | FileCopy, %INFILE%, %ICONVOUTFILE%, 1 ; 1-覆盖 67 | } 68 | 69 | FileRead, FileContents, %ICONVOUTFILE% 70 | GuiControl,, MyEdit, %FileContents% 71 | SB_SetText(ENCODING) 72 | Return 73 | } 74 | Return 75 | 76 | ; 只有显示为乱码时,才手动转换成ANSI编码 77 | SetAnsi: 78 | ENCODING := "UTF-8" 79 | SB_SetText("UTF-8? 如果仍为乱码,则输入文件编码非UTF-8") 80 | 81 | ICONVCMD := GenerateIconvCommand("UTF-8", INFILE, ICONVOUTFILE) 82 | RunWait, cmd /c %ICONVCMD%,, Hide 83 | 84 | FileRead, FileContents, %ICONVOUTFILE% 85 | GuiControl,, MyEdit, %FileContents% 86 | Return 87 | 88 | ; 对拖入的文件进行竖列对齐 89 | AlignColumn: 90 | ; 竖列对齐 91 | AWKCMD := GenerateAwkCommand(ICONVOUTFILE, AWKOUTFILE) 92 | RunWait, cmd /c %AWKCMD%,, Hide 93 | 94 | ; 消除行末空格 95 | SEDCMD := GenerateSedCommand(AWKOUTFILE, SEDOUTFILE) 96 | RunWait, cmd /c %SEDCMD%,, Hide 97 | 98 | ; 打开处理后的文件 99 | FileRead, FileContents, %SEDOUTFILE% 100 | GuiControl,, MyEdit, %FileContents% 101 | 102 | ; 选中全部内容并拷贝 103 | GuiControl, Focus, MyEdit 104 | Send ^a 105 | Send ^c 106 | 107 | CoordMode, ToolTip, Screen ; 把ToolTips放置在相对于屏幕坐标的位置 108 | ToolTip, 已拷贝到剪切板, 640, 400 109 | Sleep, 500 110 | ToolTip 111 | Return 112 | 113 | GuiClose: 114 | FileDelete, %ICONVOUTFILE% 115 | FileDelete, %AWKOUTFILE% 116 | FileDelete, %SEDOUTFILE% 117 | ExitApp 118 | 119 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 120 | ; 函数 ; 121 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 122 | 123 | ; 简单探测文件编码 124 | GetFileEncoding(filename) 125 | { 126 | encoding := "ANSI" 127 | file := FileOpen(filename, "r") 128 | if (file.Pos == 3) 129 | encoding := "UTF-8+BOM" 130 | else if (file.Pos == 2) 131 | encoding := "UTF-16" 132 | else 133 | encoding := "ANSI" ; 也有可能是UTF-8,这会造成乱码,需要在画面上手动修正 134 | 135 | file.Close() 136 | Return encoding 137 | } 138 | 139 | ; gawk -f pattern.awk inFile > outFile 140 | GenerateAwkCommand(inFile, outFile) 141 | { 142 | gawk := "gawk -f " 143 | pattern := A_WorkingDir . "\..\3rd\alignColumn.awk" 144 | 145 | awkcmd := gawk 146 | awkcmd .= """" 147 | awkcmd .= pattern 148 | awkcmd .= """" 149 | awkcmd .= " " 150 | awkcmd .= """" 151 | awkcmd .= inFile 152 | awkcmd .= """" 153 | awkcmd .= " > """ 154 | awkcmd .= outFile 155 | awkcmd .= """" 156 | 157 | Return awkcmd 158 | } 159 | 160 | ; sed -f pattern.sed inFile > outFile 161 | GenerateSedCommand(inFile, outFile) 162 | { 163 | sed := "sed -f " 164 | pattern := A_WorkingDir . "\..\3rd\trimtail.sed" 165 | 166 | sedcmd := sed 167 | sedcmd .= """" 168 | sedcmd .= pattern 169 | sedcmd .= """" 170 | sedcmd .= " " 171 | sedcmd .= """" 172 | sedcmd .= inFile 173 | sedcmd .= """" 174 | sedcmd .= " > """ 175 | sedcmd .= outFile 176 | sedcmd .= """" 177 | 178 | Return sedcmd 179 | } 180 | 181 | ; iconv -f UTF-8 -t GBK inFile > outFile 182 | GenerateIconvCommand(coding, inFile, outFile) 183 | { 184 | iconv := "iconv -f " 185 | 186 | iconvcmd := iconv 187 | iconvcmd .= coding 188 | iconvcmd .= " -t GBK " 189 | iconvcmd .= """" 190 | iconvcmd .= infile 191 | iconvcmd .= """" 192 | iconvcmd .= " > """ 193 | iconvcmd .= outFile 194 | iconvcmd .= """" 195 | 196 | Return iconvcmd 197 | } 198 | 199 | ; cut -b 4- inFile > outFile 200 | GenerateCutCommand(inFile, outFile) 201 | { 202 | cut := "cut -b 4- " ; cut "EF BB BF" BOM to generate outFile with UTF-8 encoding 203 | ; 该命令有BUG,会造成每行第一个字符被裁剪 204 | 205 | cutcmd := cut 206 | cutcmd .= """" 207 | cutcmd .= inFile 208 | cutcmd .= """" 209 | cutcmd .= " > """ 210 | cutcmd .= outFile 211 | cutcmd .= """" 212 | 213 | Return cutcmd 214 | } 215 | 216 | ; 去掉UTF-8+BOM文件的BOM头 217 | RemoveUTF8BOM(InputFile, OutputFile) 218 | { 219 | OrigEncoding := A_FileEncoding 220 | FileEncoding ; 脚本默认以ANSI编码处理外部文件 221 | FileRead, Content, %InputFile% 222 | FileEncoding, UTF-8-RAW 223 | FileAppend, %Content%, %OutputFile% 224 | FileEncoding, %OrigEncoding% ; 恢复编码 225 | } 226 | -------------------------------------------------------------------------------- /scripts/+09.定位注册表.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 事先拷贝注册表路径,该脚本直接定位到那个路径 3 | ; 4 | ; gaochao.morgen@gmail.com 5 | ; 2014/2/4 6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 | 8 | #SingleInstance Force 9 | #NoTrayIcon 10 | #NoEnv 11 | 12 | StringReplace, Clipboard, Clipboard, \, \, All ; 网络文章"\","\"不分 13 | StringReplace, Clipboard, Clipboard, /, \, All ; "/"改为"\" 14 | StringReplace, Clipboard, Clipboard, \\, \, All ; "/"改为"\" 15 | Clipboard := RegExReplace(Clipboard, "\\$", "") ; 若最后一个字符为"\"则去掉 16 | 17 | ; 本想先探测是否存在改键,但是此方法无法判断出"(默认)"为空的项 18 | ;pos := RegExMatch(Clipboard, "HKEY_(.*?)\\", RootKey) ; "我的电脑\HKEY_CURRENT_USER\Software"与"HKEY_CURRENT_USER\Software"一样 19 | ;SubKey := SubStr(Clipboard, pos+StrLen(RootKey)) 20 | ;StringReplace, RootKey, RootKey, \, , All 21 | ; 22 | ;RegRead, content, %RootKey%, %SubKey% 23 | ;if (content = null && ErrorLevel = 1) 24 | ;{ 25 | ; MsgBox, %Clipboard% is not found. 26 | ; Return 27 | ;} 28 | 29 | ; 关闭已经打开的注册表 30 | IfWinExist, ahk_class RegEdit_RegEdit 31 | { 32 | WinClose 33 | WinWaitClose 34 | } 35 | 36 | ; 写入 37 | RegWrite, REG_SZ, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Applets\Regedit, LastKey, %Clipboard% 38 | 39 | ; 打开,自动定位到写入位置 40 | Run, regedit,, Max 41 | ExitApp 42 | 43 | -------------------------------------------------------------------------------- /scripts/+10.添加删除程序.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 一键启动添加删除程序 3 | ; 4 | ; gaochao.morgen@gmail.com 5 | ; 2014/2/4 6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 | 8 | #SingleInstance Force 9 | #NoEnv 10 | 11 | Run, control appwiz.cpl 12 | ExitApp 13 | 14 | ; 注意: 如果希望从命令提示符运行命令,必须在 Windows 文件夹下进行操作。 15 | ; 同时,请注意您的计算机可能并没有本文中所列的所有工具,因为您的 Windows 安装可能没有包括所有这些组件。 16 | ; 17 | ; Control panel tool Command 18 | ; ----------------------------------------------------------------- 19 | ; Accessibility Options control access.cpl 20 | ; Add New Hardware control sysdm.cpl add new hardware 21 | ; Add/Remove Programs control appwiz.cpl 22 | ; Date/Time Properties control timedate.cpl 23 | ; Display Properties control desk.cpl 24 | ; FindFast control findfast.cpl 25 | ; Fonts Folder control fonts 26 | ; Internet Properties control inetcpl.cpl 27 | ; Joystick Properties control joy.cpl 28 | ; Keyboard Properties control main.cpl keyboard 29 | ; Microsoft Exchange control mlcfg32.cpl 30 | ; (or Windows Messaging) 31 | ; Microsoft Mail Post Office control wgpocpl.cpl 32 | ; Modem Properties control modem.cpl 33 | ; Mouse Properties control main.cpl 34 | ; Multimedia Properties control mmsys.cpl 35 | ; Network Properties control netcpl.cpl 36 | ; NOTE: In Windows NT 4.0, Network 37 | ; properties is Ncpa.cpl, not Netcpl.cpl 38 | ; Password Properties control password.cpl 39 | ; PC Card control main.cpl pc card (PCMCIA) 40 | ; Power Management (Windows 95) control main.cpl power 41 | ; Power Management (Windows 98) control powercfg.cpl 42 | ; Printers Folder control printers 43 | ; Regional Settings control intl.cpl 44 | ; Scanners and Cameras control sticpl.cpl 45 | ; Sound Properties control mmsys.cpl sounds 46 | ; System Properties control sysdm.cpl 47 | ; 48 | ; 49 | ; 注意: “扫描仪与数字相机”程序 (sticpl.cpl) 无法在 Windows Millenium 中运行。 50 | ; 该程序已经被“扫描仪与数字相机”文件夹取代,其功能与如“打印机”文件夹和“拨号网络”文件夹之类的文件夹类似。 51 | ; 52 | ; Windows 以要运行的工具名称替换 %1%。。例如: 53 | ; “rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl”。 54 | ; 要运行“控制面板”中的“用户”工具,请键入 control Ncpa.cpl users,然后按 ENTER 键。 55 | ; 56 | ; 要运行 Windows 95/98/ME 的“用户”工具,请键入“control inetcpl.cpl users”(不键入引号),然后按 ENTER 键。 57 | 58 | -------------------------------------------------------------------------------- /scripts/+11.网络连接.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 一键启动网络连接 3 | ; 4 | ; gaochao.morgen@gmail.com 5 | ; 2014/2/4 6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 | 8 | #SingleInstance Force 9 | #NoEnv 10 | 11 | Run, ::{7007acc7-3202-11d1-aad2-00805fc1270e},, Max 12 | ExitApp 13 | 14 | -------------------------------------------------------------------------------- /scripts/+12.重启Explorer.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 重新启动explorer.exe 3 | ; 4 | ; gaochao.morgen@gmail.com 5 | ; 2013/7/2 6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 | 8 | #SingleInstance Force 9 | #NoEnv 10 | 11 | ; 将ErrorLevel置为本脚本PID 12 | Process, Exist 13 | 14 | ; 获取explorer进程PID,保存在ErrorLevel中 15 | Process, Exist, explorer.exe 16 | PID := ErrorLevel 17 | if (PID) 18 | { 19 | Process, Close, %PID% 20 | Process, Wait, %PID%, 5 ; 会自动重新启动,如果没有自动重启,则手动重启 21 | if (ErrorLevel = 0) 22 | Run, %A_WinDir%\explorer.exe 23 | } 24 | else 25 | { 26 | Run, %A_WinDir%\explorer.exe 27 | } 28 | 29 | -------------------------------------------------------------------------------- /scripts/+13.关闭任务栏窗口.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 一键关闭任务栏上的所有打开窗口 3 | ; 4 | ; gaochao.morgen@gmail.com 5 | ; 2014/5/22 6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 | 8 | #Include ../lib/Taskbar.ahk 9 | 10 | #SingleInstance Force 11 | #NoEnv 12 | 13 | SetBatchLines, -1 14 | 15 | CloseAllWindow() 16 | Return 17 | 18 | CloseAllWindow() 19 | { 20 | static WM_SETREDRAW = 0xB 21 | TaskbarHwnd := Taskbar_GetHandle() 22 | SendMessage, WM_SETREDRAW, 0,,, ahk_id %TaskbarHwnd% 23 | 24 | ; 获取当前任务栏所有按钮所属窗口的HWND 25 | HwndsStr := Taskbar_Define("", "w") "`n" 26 | 27 | StringSplit, WindowHwnd, HwndsStr, `n 28 | Loop %WindowHwnd0% 29 | { 30 | Hwnd := WindowHwnd%A_Index% 31 | WinClose, ahk_id %Hwnd% 32 | } 33 | 34 | SendMessage, WM_SETREDRAW, 1,,, ahk_id %TaskbarHwnd% 35 | } 36 | 37 | -------------------------------------------------------------------------------- /scripts/+14.AHK版本号.ahk: -------------------------------------------------------------------------------- 1 | ; 判断当前运行的 AutoHotkey Basic/AutoHotkey_L 版本 2 | #SingleInstance Force 3 | #NoTrayIcon 4 | #NoEnv 5 | 6 | CheckCurrentVersion() 7 | Return 8 | 9 | CheckCurrentVersion() 10 | { 11 | if (A_AhkVersion = "") 12 | MsgBox, AutoHotkey Basic, 版本号小于 1.0.22 13 | else if (A_AhkVersion <= "1.0.48.05") 14 | MsgBox, AutoHotkey Basic, 版本号为 %A_AhkVersion% 15 | else 16 | MsgBox, % "AutoHotkey_L" (A_PtrSize = 4 ? (A_IsUnicode ? " Unicode ":" ANSI "):" 64 位") "版本, 版本号为" A_AhkVersion 17 | return 18 | } 19 | -------------------------------------------------------------------------------- /scripts/+15.下班时间.ahk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/scripts/+15.下班时间.ahk -------------------------------------------------------------------------------- /scripts/+16.CmdMarkdownBackup.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; Cmd Markdown一键导出的包默认按照Tag进行多目录存储,我需要将所有这些子目录的文件全部集中在一起 3 | ; 并且下载*.md文档中引用的资源(包括图片,附件等) 4 | ; 5 | ; 目录结构类似于: 6 | ; Cmd-Markdowns-2016-03-28-20-44 7 | ; |-- AngularJS 8 | ; | AngularJS Phonecat示例学习.md 9 | ; | 手动创建AngularJS项目.md 10 | ; | 模板创建AngularJS项目.md 11 | ; | 12 | ; |-- Hadoop 13 | ; | RHadoop安装步骤.md 14 | ; | Sqoop1.4.6安装步骤.md 15 | ; | ZooKeeper3.4.6安装步骤.md 16 | ; | 大数据工具链.md 17 | ; 18 | ; gaochao.morgen@gmail.com 19 | ; 2016/3/28 20 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 21 | 22 | #Persistent 23 | #SingleInstance Force 24 | #NoEnv 25 | 26 | BgImage = %A_ScriptDir%/../resources/Cmd.png 27 | if (!FileExist(BgImage)) 28 | { 29 | MsgBox, % BgImage . "未找到" 30 | ;ExitApp 31 | } 32 | 33 | ; +Owner,任务栏中不出现,ALT-TAB中出现. -Owner,任务栏中出现,ALT-TAB中出现. 默认是-Owner 34 | ; +LastFound "上次找到的" 窗口, 让脚本更容易创建和维护 35 | Gui, -Owner +LastFound 36 | 37 | ; 设置在没有为控件指定明确的位置时使用的边距/间隔 38 | Gui, Margin, 0, 0 39 | 40 | Gui, Add, Picture, vCanvas, %BgImage% 41 | Gui, Show,, 拖拽目录或者zip文件到窗口中 42 | 43 | Return 44 | 45 | ; 响应文件拖动事件 46 | GuiDropFiles: 47 | ; 提取文件全名 48 | Loop, parse, A_GuiEvent, `n 49 | { 50 | Target := A_LoopField 51 | if (Target = "") 52 | Return 53 | break 54 | } 55 | 56 | CurrentDir := Target 57 | 58 | ; 如果是zip文件,则新建目录,并解压缩到该目录,再处理 59 | ; 如果是已经解压缩的目录,则直接处理 60 | SplitPath, Target,, Dir, Ext, FileNoExt 61 | if (Ext = "zip") 62 | { 63 | OutDir = %Dir%\%FileNoExt% 64 | if (!IsDirExist(OutDir)) 65 | FileCreateDir, %OutDir% 66 | 67 | UnzipCmd := GenerateUnzipCommand(Target, OutDir) 68 | RunWait, cmd /c %UnzipCmd%,, Hide 69 | 70 | CurrentDir := OutDir 71 | } 72 | else if (Ext = "md") 73 | { 74 | MsgBox, 请将所有md文件放置到一个目录中,并将该目录拖动到本程序上 75 | Return 76 | } 77 | 78 | ; 2 - 仅针对子目录 79 | Loop, %CurrentDir%\*, 2 80 | { 81 | SetWorkingDir %A_LoopFileFullPath% 82 | 83 | ; 依次移动每个文档 84 | Loop, %A_LoopFileFullPath%\*.md 85 | MoveMdToDir(A_LoopFileName, CurrentDir, A_LoopFileName) 86 | } 87 | 88 | SetWorkingDir %CurrentDir% 89 | 90 | ; 删除所有子目录 91 | Loop, %CurrentDir%\*, 2 92 | FileRemoveDir, %A_LoopFileFullPath%, 1 93 | 94 | ; 查询所有.md文件,找到资源URL 95 | ParseUrlList() 96 | 97 | ; 原窗口最小化 98 | WinMinimize, %vCanvas% 99 | 100 | ; 设置进度条 101 | Progress, A M1 FS8 FM10 H80 W300,, 正在下载资源,, Courier New 102 | 103 | ; 统计资源数量 104 | ResCount := 0 105 | Loop, Read, url.txt 106 | ResCount := ResCount + 1 107 | 108 | ; 依次下载资源 109 | Loop, Read, url.txt 110 | { 111 | ; 更新进度条 112 | Percent := Round(A_Index*100/ResCount) 113 | Progress, %Percent%, %A_LoopReadLine% 114 | 115 | SplitPath, A_LoopReadLine, name 116 | dirname := GetDirName(A_LoopReadLine) 117 | FileCreateDir, %dirname% ; 该目录及其父目录如果不存在,均会创建 118 | if (ErrorLevel != 0) 119 | { 120 | MsgBox, 创建目录失败 121 | continue 122 | } 123 | 124 | name := dirname . name 125 | UrlDownloadToFile, %A_LoopReadLine%, %name% 126 | } 127 | 128 | Progress,,, 正在打包,, Courier New 129 | 130 | ZipFile := "resource.zip" 131 | Progress, 99, %ZipFile% 132 | 133 | ; 将资源目录进行压缩,并删除 134 | Loop, %CurrentDir%\*, 2 135 | { 136 | ZipCmd := GenerateZipCommand(A_LoopFileFullPath, ZipFile) 137 | RunWait, cmd /c %ZipCmd%,, Hide 138 | FileRemoveDir, %A_LoopFileFullPath%, 1 139 | } 140 | 141 | ; 将url.txt加入压缩文件,并删除 142 | ZipCmd := GenerateZipCommand("url.txt", ZipFile) 143 | RunWait, cmd /c %ZipCmd%,, Hide 144 | FileDelete, url.txt 145 | 146 | ZipFile := FileNoExt . ".zip" 147 | Progress, 100, %ZipFile% 148 | 149 | ; 将*.md文档进行压缩,并删除 150 | ZipCmd := GenerateZipCommand("*.md", ZipFile) 151 | RunWait, cmd /c %ZipCmd%,, Hide 152 | FileDelete, *.md 153 | 154 | Progress, Off 155 | WinRestore, %vCanvas% 156 | 157 | SetWorkingDir %A_ScriptDir% 158 | MsgBox, 全部md文件已经汇总完成 159 | Return 160 | 161 | GuiClose: 162 | ExitApp 163 | 164 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 165 | ; 函数 ; 166 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 167 | 168 | ; 判断目录是否存在 169 | IsDirExist(DirName) 170 | { 171 | if (FileExist(DirName)) 172 | { 173 | if InStr(FileExist(DirName), "D") 174 | return true 175 | } 176 | 177 | return false 178 | } 179 | 180 | ; 将指定文件拷贝到指定目录,并且重命名 181 | MoveMdToDir(OrigName, TargetDir, TargetName := "") 182 | { 183 | ; 源文件不存在,记录错误 184 | if (!FileExist(OrigName)) 185 | { 186 | FileAppend, % OrigName . "不存在", Error.log 187 | FileAppend, `n, Error.log 188 | Return 189 | } 190 | 191 | ; 目录不存在则创建 192 | IfNotExist, %TargetDir% 193 | FileCreateDir, %TargetDir% 194 | 195 | if (TargetName != "") 196 | TargetName := TargetDir . "\" . TargetName 197 | else 198 | TargetName := TargetDir . "\" . OrigName 199 | 200 | ; 移动源文件到新文件. 覆盖模式 201 | FileMove, %OrigName%, %TargetName%, 1 202 | if (ErrorLevel != 0) 203 | { 204 | FileAppend, % OrigName . "移动到" . TargetName . "失败", Error.log 205 | FileAppend, `n, Error.log 206 | Return 207 | } 208 | } 209 | 210 | ; 生成解压缩命令 211 | GenerateUnzipCommand(zipFile, dstDir) 212 | { 213 | unzipcmd := "7z.exe x " 214 | unzipcmd .= zipFile 215 | unzipcmd .= " -o" 216 | unzipcmd .= dstDir 217 | 218 | Return unzipcmd 219 | } 220 | 221 | ; 生成压缩命令 222 | GenerateZipCommand(dir, zipFile) 223 | { 224 | zipcmd := "7z.exe a " 225 | zipcmd .= zipFile 226 | zipcmd .= " " 227 | zipcmd .= dir 228 | 229 | Return zipcmd 230 | } 231 | 232 | ; 从*.md文件中解析所有资源的URL 233 | ParseUrlList() 234 | { 235 | ; 采用PCRE正则. 匹配的字符串格式为"[1]: http://static.zybuluo.com/morgen/9nvm3lj1u4hjc5zk3h4iu79r/bash.png" 236 | ; 这是Cmd Markdown特有的格式,上传到服务器上的资源均采用这种格式 237 | ; 按理说,保存为url.txt后,使用"wget -p -i url.txt"即可以下载全部资源,然而Windows下的wget并不能很好地处理中文URL,因此放弃wget 238 | ; -H 总是打印文件名. 只有一个文件时默认不打印,会对解析造成影响 239 | cmd := "grep -P -H ""\[\d+\]: [a-zA-z]+://[^\s]*\.[a-zA-Z]{3,4}$"" *.md | gawk ""BEGIN{FS=\"": \""} {print $3}"" > url.txt" 240 | RunWait, cmd /c %cmd%,, Hide 241 | 242 | ; 匹配的字符串格式为"![cmd-markdown-logo](https://www.zybuluo.com/static/img/logo.png)" 243 | ; 这是外链格式,适合外部图床. 追加到url.txt中. 这种模式下仅考虑图片资源 244 | cmd := "grep -P -H ""\([a-zA-z]+://[^\s]*\.(png|PNG|jpg|JPG|jpeg|JPEG)\)"" *.md | gawk ""BEGIN{FS=\""[()]\""} {print $2}"" >> url.txt" 245 | RunWait, cmd /c %cmd%,, Hide 246 | } 247 | 248 | ; 从URL中解析目录结构 249 | GetDirName(url) 250 | { 251 | StringGetPos, pos1, url, // ; "//"的位置 252 | StringGetPos, pos2, url, /, R1 ; 从右开始,第1个"/"的位置 253 | dir := SubStr(url, pos1+1+2, pos2-pos1-1) 254 | StringReplace, out, dir, /, \, All ; 255 | Return out 256 | } 257 | 258 | 259 | -------------------------------------------------------------------------------- /scripts/+17. 更新Hosts.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 自动更新Hosts文件 3 | ; 源项目参见 https://github.com/racaljk/hosts 4 | ; 5 | ; gaochao.morgen@gmail.com 6 | ; 2016/11/10 7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 8 | 9 | #Persistent 10 | #SingleInstance Force 11 | #NoEnv 12 | 13 | SetWorkingDir %A_ScriptDir% 14 | 15 | FileEncoding, UTF-8-RAW 16 | 17 | SYSHOSTS := "C:\Windows\System32\drivers\etc\hosts" 18 | ;URL := "https://raw.githubusercontent.com/racaljk/hosts/master/hosts" 19 | URL := "https://raw.githubusercontent.com/googlehosts/hosts/master/hosts-files/hosts" 20 | 21 | ; 手动添加 raw.githubusercontent.com 的IP,否则从这个网站下载文件很困难 22 | ; 至于这个IP,可以从 http://tool.chinaz.com/dns 上查询,选择速度快的一个 23 | FileAppend, 24 | ( 25 | `r 26 | 151.101.76.133 raw.githubusercontent.com 27 | ), % SYSHOSTS 28 | 29 | ; 刷新DNS 30 | RunWait, cmd /c "ipconfig /flushdns",, Hide 31 | 32 | ; 下载 hosts 文件 33 | ToolTipX := A_ScreenWidth / 2 34 | ToolTipY := A_ScreenHeight / 2 35 | ToolTip, 正在下载 Hosts 文件, %ToolTipX%, %ToolTipY% 36 | SetTimer, RemoveToolTip, 1000 37 | 38 | HostsFile := A_Temp "\hosts" 39 | 40 | try { 41 | URLDownloadToFile, % URL, % HostsFile 42 | if (ErrorLevel == 1) 43 | throw Exception("Fail", -1) 44 | } 45 | catch 46 | { 47 | ; 尝试爬虫方案 48 | try { 49 | ToolTip, 直接下载失败,尝试爬虫方案, %ToolTipX%, %ToolTipY% 50 | RunWait, cmd /c "python ..\\3rd\\gethosts.py",, Hide 51 | if (ErrorLevel != 0) 52 | throw Exception("Fail", -1) 53 | Sleep, 100 ; Wait writing file 54 | FileCopy, ..\log\hosts.parsed, % HostsFile 55 | } 56 | catch 57 | { 58 | MsgBox, 下载失败,请重新尝试 59 | ExitApp 60 | } 61 | } 62 | 63 | FileAppend, 64 | ( 65 | `r 66 | 10.65.6.44 BigData1637 67 | 10.65.6.33 BigData1635 68 | 10.73.1.191 bigdata-1 69 | 10.73.1.192 bigdata-2 70 | 10.73.1.193 bigdata-3 71 | 10.73.1.194 bigdata-4 72 | 10.73.1.195 bigdata-5 73 | 10.73.1.191 node1.hde.h3c.com 74 | 10.73.1.192 node2.hde.h3c.com 75 | 10.73.1.193 node3.hde.h3c.com 76 | 10.73.1.194 node4.hde.h3c.com 77 | 10.73.1.195 node5.hde.h3c.com 78 | 10.73.8.101 lenovo.test1.com 79 | 10.73.8.102 lenovo.test2.com 80 | 10.73.8.103 lenovo.test3.com 81 | 151.101.76.133 assets-cdn.github.com 82 | 151.101.76.133 raw.githubusercontent.com 83 | ), % HostsFile 84 | 85 | ; 备份原来的hosts文件 86 | backupCmd := "copy " 87 | backupCmd .= SYSHOSTS 88 | backupCmd .= " " 89 | backupCmd .= SYSHOSTS 90 | backupCmd .= A_Now 91 | RunWait, cmd /c %backupCmd%,, Hide 92 | 93 | ; 将新的hosts文件拷贝到系统路径 94 | copyCmd := "copy /Y " 95 | copyCmd .= HostsFile 96 | copyCmd .= " " 97 | copyCmd .= SYSHOSTS 98 | RunWait, cmd /c %copyCmd%,, Hide 99 | 100 | ; 刷新DNS 101 | RunWait, cmd /c "ipconfig /flushdns",, Hide 102 | FileDelete, % HostsFile 103 | 104 | MsgBox, 更新完毕! 105 | ExitApp 106 | 107 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 108 | ; 函数 ; 109 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 110 | 111 | RemoveToolTip: 112 | SetTimer, RemoveToolTip, Off 113 | ToolTip 114 | Return 115 | 116 | -------------------------------------------------------------------------------- /scripts/+18. 颜色拾取.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 显示鼠标下的颜色RGB值 3 | ; 4 | ; gaochao.morgen@gmail.com 5 | ; 2017/3/13 6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 | 8 | #Include ../lib/HexDec.ahk 9 | 10 | #Persistent 11 | #SingleInstance, Force 12 | #NoEnv 13 | 14 | Loop 15 | { 16 | Sleep, 200 17 | MouseGetPos, x, y 18 | PixelGetColor, rgb, x, y, RGB 19 | 20 | r := SubStr(rgb, 3, 2) 21 | g := SubStr(rgb, 5, 2) 22 | b := SubStr(rgb, 7, 2) 23 | 24 | rd := Hex2Dec("0x" . r) 25 | gd := Hex2Dec("0x" . g) 26 | bd := Hex2Dec("0x" . b) 27 | 28 | ToolTip, %rgb%`n%rd%`,%gd%`,%bd%`n`nPress MButton to copy RGB hex`nPress Esc to exit 29 | GetKeyState, state, MButton 30 | if state = D 31 | { 32 | Clipboard := rgb 33 | ToolTip, %rgb% Copied. 34 | } 35 | } 36 | 37 | Esc:: 38 | ExitApp 39 | Return 40 | 41 | -------------------------------------------------------------------------------- /scripts/CMD.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 更改CMD的一些行为 3 | ; 4 | ; Ctrl + L: 仿Linux Term下Ctrl+L的清屏行为 5 | ; Ctrl + U: 清空当前输入的命令 6 | ; Ctrl + V: CMD窗口粘贴 7 | ; 8 | ; gaochao.morgen@gmail.com 9 | ; 2014/2/4 10 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 11 | 12 | #Persistent 13 | #SingleInstance Force 14 | #NoTrayIcon 15 | #NoEnv 16 | 17 | ; Ctrl + L, 仿Linux Term下Ctrl+L的清屏行为 18 | #IfWinActive ahk_class ConsoleWindowClass 19 | ^l:: 20 | SendInput {Raw}clear ; clear.cmd内容如下, 需要将clear.cmd放入PATH中. cls也可以直接用,但顶端一行空行无法清除 21 | Send {Enter} 22 | Return 23 | 24 | ; Ctrl + U, 清空当前输入的命令 25 | ^u:: 26 | Send {BS 12} 27 | Return 28 | 29 | ; Ctrl + V, 粘贴 30 | #IfWinActive ahk_class ConsoleWindowClass 31 | ^v:: 32 | Send %Clipboard% 33 | Return 34 | 35 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 36 | ; clear.cmd ; 37 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 38 | ; @echo off 39 | ; cls %* 40 | -------------------------------------------------------------------------------- /scripts/CmdMarkdownCenter.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 在 CmdMarkdown 中一键插入
标签,使图像居中显示 3 | ; 4 | ; 快捷键: F9 使整行内容居中 5 | ; 快捷键: F10 为整行添加下划线 6 | ; 7 | ; gaochao.morgen@gmail.com 8 | ; 2016/12/14 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | #Include ../lib/HexDec.ahk 12 | 13 | #Persistent 14 | #SingleInstance Force 15 | #NoTrayIcon 16 | #NoEnv 17 | 18 | #IfWinActive ahk_class Chrome_WidgetWin_0 19 | F9:: 20 | ; hWnd - CmdMarkdown的窗口句柄 21 | WinGet, hWnd, ID, ahk_class Chrome_WidgetWin_0 22 | CurrentIME := GetCurrentIME(hWnd) 23 | SetEnglishIME(hWnd) 24 | 25 | ; 为当前行加入
标签对 26 | Send {Esc} 27 | Send {RShift}{^} 28 | Send {} 29 | SendInput {Raw}i
30 | Send {Esc} 31 | Send {RShift}{$} 32 | SendInput {Raw}a
33 | Send {Enter 1} 34 | 35 | ; 恢复之前的输入法 36 | SetIME(CurrentIME, hWnd) 37 | Return 38 | 39 | #IfWinActive ahk_class Chrome_WidgetWin_0 40 | F10:: 41 | ; hWnd - CmdMarkdown的窗口句柄 42 | WinGet, hWnd, ID, ahk_class Chrome_WidgetWin_0 43 | CurrentIME := GetCurrentIME(hWnd) 44 | SetEnglishIME(hWnd) 45 | 46 | ; 为当前行加入下划线标签对 47 | Send {Esc} 48 | Send {RShift}{^} 49 | Send {} 50 | SendInput {Raw}i 51 | Send {Esc} 52 | Send {RShift}{$} 53 | SendInput {Raw}a 54 | Send {Enter 1} 55 | 56 | ; 恢复之前的输入法 57 | SetIME(CurrentIME, hWnd) 58 | Return 59 | 60 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 61 | ; 函数 ; 62 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 63 | 64 | ; 为指定窗口设置英文输入法 65 | ; @param hWnd 窗口句柄 66 | SetEnglishIME(hWnd) { 67 | SetIME("04090409", hWnd) 68 | } 69 | 70 | ; 获取指定窗口当前的输入法 71 | ; @param hWnd 窗口句柄 72 | ; @return 输入法对应的十六进制数字符串,无0x前缀 73 | GetCurrentIME(hWnd) { 74 | dec := DllCall("GetKeyboardLayout", "UInt", DllCall("GetWindowThreadProcessId", "UInt", hWnd, "UIntp", 0), UInt) 75 | hex := Dec2Hex(dec) 76 | StringTrimLeft, layout, hex, 2 77 | Return layout 78 | } 79 | 80 | ; 设置指定窗口的输入法 81 | ; @param Layout 输入法代码 82 | ; @param hWnd 窗口句柄 83 | SetIME(Layout, hWnd) { 84 | DllCall("SendMessage", "UInt", hWnd, "UInt", "80", "UInt", "1", "UInt", (DllCall("LoadKeyboardLayout", "Str", Layout, "UInt", "257"))) 85 | } 86 | 87 | -------------------------------------------------------------------------------- /scripts/CmdMarkdownRegExp.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 在 CmdMarkdown 执行全文替换,使得中文和英文之间留出一个空格 3 | ; 注意 CmdMarkdown 使用的是 JavaScript 的正则表达式语法 4 | ; 5 | ; 使用时,CmdMarkdown 必须位于 Vim 编辑器模式 6 | ; 按下 ":" 后再按 Ctrl+L 在英文左边加一个空格 7 | ; 按下 ":" 后再按 Ctrl+R 在英文右边加一个空格 8 | ; 按上面顺序执行完毕后,中英文间的空格替换完成 9 | ; 10 | ; 快捷键: Ctrl+L,完成左边加空格;Ctrl+R,完成右边加空格 11 | ; 12 | ; gaochao.morgen@gmail.com 13 | ; 2017/3/17 14 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 15 | 16 | #Persistent 17 | #SingleInstance Force 18 | #NoTrayIcon 19 | #NoEnv 20 | 21 | ; Ctrl + L 22 | #IfWinActive ahk_class Chrome_WidgetWin_0 23 | ^l:: 24 | Clipboard := "%s/([^A-z0-9 -@.:<>!\/\[\](){}|'`,。!、;:“‘()])([A-Za-z0-9%``])/$1 $2/g" 25 | Send ^v 26 | Clipboard := 27 | Return 28 | 29 | ; Ctrl + R 30 | #IfWinActive ahk_class Chrome_WidgetWin_0 31 | ^r:: 32 | Clipboard := "%s/([A-Za-z0-9%``])([^A-z0-9 -@.:<>!\/\[\](){}|'`,。!、;:“‘()])/$1 $2/g" 33 | Send ^v 34 | Clipboard := 35 | Return 36 | 37 | -------------------------------------------------------------------------------- /scripts/NetMeter.ahk: -------------------------------------------------------------------------------- 1 | ; 2 | ; It displays the network download/upload KB in progress bar. 3 | ; By Sean 4 | ; 5 | #SingleInstance, Force 6 | #NoTrayIcon 7 | #NoEnv 8 | 9 | #Include ../lib/DpiScale.ahk 10 | 11 | ; Adjust X & Y to suit your screen res 12 | StartX := A_ScreenWidth - (376*GetDpiScale()) 13 | StartY := 1 14 | 15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 16 | 17 | Gui, -Caption +Border +AlwaysOnTop +ToolWindow 18 | Gui, Color, EEAA99 19 | Gui, +LastFound 20 | WinSet, TransColor, EEAA99 21 | Gui, Add, Progress, w100 h10 cGreen -0x1 vDn 22 | Gui, Add, Progress, x+10 w100 h10 cRed -0x1 vUp 23 | Gui, Show, x%StartX% y%StartY%, NetMeter 24 | 25 | If GetIfTable(tb) 26 | ExitApp 27 | 28 | SetTimer, NetMeter, On, 1000 29 | Return 30 | 31 | NetMeter: 32 | dnNew := 0 33 | upNew := 0 34 | 35 | GetIfTable(tb) 36 | 37 | Loop, % DecodeInteger(&tb) 38 | { 39 | /* Include this codes to exclude the loopback interface. 40 | If DecodeInteger(&tb + 4 + 860 * (A_Index - 1) + 516) = 24 41 | Continue 42 | */ 43 | dnNew += DecodeInteger(&tb + 4 + 860 * (A_Index - 1) + 552) ; Total Incoming Octets 44 | upNew += DecodeInteger(&tb + 4 + 860 * (A_Index - 1) + 576) ; Total Outgoing Octets 45 | } 46 | 47 | dnRate := Round((dnNew - dnOld) / 1024) 48 | upRate := Round((upNew - upOld) / 1024) 49 | 50 | GuiControl,, Dn, %dnRate% 51 | GuiControl,, Up, %upRate% 52 | 53 | dnOld := dnNew 54 | upOld := upNew 55 | Return 56 | 57 | GetIfTable(ByRef tb, bOrder = True) 58 | { 59 | nSize := 4 + 860 * GetNumberOfInterfaces() + 8 60 | VarSetCapacity(tb, nSize) 61 | Return DllCall("iphlpapi\GetIfTable", "Uint", &tb, "UintP", nSize, "int", bOrder) 62 | } 63 | 64 | GetIfEntry(ByRef tb, idx) 65 | { 66 | VarSetCapacity(tb, 860) 67 | DllCall("ntdll\RtlFillMemoryUlong", "Uint", &tb + 512, "Uint", 4, "Uint", idx) 68 | Return DllCall("iphlpapi\GetIfEntry", "Uint", &tb) 69 | } 70 | 71 | GetNumberOfInterfaces() 72 | { 73 | DllCall("iphlpapi\GetNumberOfInterfaces", "UintP", nIf) 74 | Return nIf 75 | } 76 | 77 | DecodeInteger(ptr) 78 | { 79 | Return *ptr | *++ptr << 8 | *++ptr << 16 | *++ptr << 24 80 | } 81 | 82 | -------------------------------------------------------------------------------- /scripts/ObsidianShortcuts.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 自定义Obsidian快捷键 3 | ; 注意Obisidan必须位于Vim编辑器模式 4 | ; 5 | ; 快捷键: F8 新建文档后加入作者、时间 6 | ; 快捷键: F9 一键插入
标签,使整行内容居中 7 | ; 快捷键: F10 为整行添加下划线 8 | ; 快捷键:F11 在整篇文章的中文和英文之间加入空格 9 | ; 10 | ; gaochao.morgen@gmail.com 11 | ; 2023/12/14 12 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 13 | 14 | #Include ../lib/SwitchIME.ahk 15 | 16 | #Persistent 17 | #SingleInstance Force 18 | #NoTrayIcon 19 | #NoEnv 20 | 21 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 22 | ; 快捷键 ; 23 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 24 | 25 | ; 针对 Obsidian 26 | ; 新建文档后加入作者、时间 27 | #IfWinActive ahk_class Chrome_WidgetWin_1 28 | F8:: 29 | ; hWnd - CmdMarkdown的窗口句柄 30 | WinGet, hWnd, ID, ahk_class Chrome_WidgetWin_1 31 | CurrentIME := GetCurrentIME(hWnd) 32 | ;MsgBox, % CurrentIME 33 | SetEnglishIME(hWnd) 34 | 35 | ; 添加创建时间 36 | Send {Esc} 37 | Send {1}{G} 38 | SendInput {Raw}i 39 | Send {Enter} 40 | SendInput %A_YYYY%-%A_MM%-%A_DD% 41 | Send {Enter 2} 42 | SendInput {Raw}# 43 | Send {Enter 2} 44 | SendInput --- 45 | Send {Enter} 46 | Send {Esc} 47 | 48 | ; 定位到#那一行 49 | Send {4}{G} 50 | 51 | ; 恢复之前的输入法 52 | SetIME(CurrentIME, hWnd) 53 | Return 54 | 55 | ; 针对 Obsidian 56 | ; 一键插入
标签,使整行内容居中 57 | #IfWinActive ahk_class Chrome_WidgetWin_1 58 | F9:: 59 | ; hWnd - CmdMarkdown的窗口句柄 60 | WinGet, hWnd, ID, ahk_class Chrome_WidgetWin_1 61 | CurrentIME := GetCurrentIME(hWnd) 62 | SetEnglishIME(hWnd) 63 | 64 | ; 为当前行加入
标签对 65 | Send {Esc} 66 | Send {RShift}{^} 67 | Send {} 68 | SendInput {Raw}i
69 | Send {Esc} 70 | Send {RShift}{$} 71 | SendInput {Raw}a
72 | Send {Enter 1} 73 | 74 | ; 恢复之前的输入法 75 | SetIME(CurrentIME, hWnd) 76 | Return 77 | 78 | ; 针对 Obsidian 79 | ; 为整行添加下划线 80 | #IfWinActive ahk_class Chrome_WidgetWin_1 81 | F10:: 82 | ; hWnd - CmdMarkdown的窗口句柄 83 | WinGet, hWnd, ID, ahk_class Chrome_WidgetWin_1 84 | CurrentIME := GetCurrentIME(hWnd) 85 | SetEnglishIME(hWnd) 86 | 87 | ; 为当前行加入下划线标签对 88 | Send {Esc} 89 | Send {RShift}{^} 90 | Send {} 91 | SendInput {Raw}i 92 | Send {Esc} 93 | Send {RShift}{$} 94 | SendInput {Raw}a 95 | Send {Enter 1} 96 | 97 | ; 恢复之前的输入法 98 | SetIME(CurrentIME, hWnd) 99 | Return 100 | 101 | ; 针对 Obsidian 102 | ; 快捷键:F11 在中文和英文之间加入空格 103 | #IfWinActive ahk_class Chrome_WidgetWin_1 104 | F11:: 105 | ; hWnd - CmdMarkdown的窗口句柄 106 | WinGet, hWnd, ID, ahk_class Chrome_WidgetWin_1 107 | CurrentIME := GetCurrentIME(hWnd) 108 | SetEnglishIME(hWnd) 109 | 110 | ; 在英文左边加空格 111 | LeftSpaceCommand := "%s/([^A-z0-9 -@.:<>!\/\[\](){}|'`,。!、;:“‘()])([A-Za-z0-9%``])/$1 $2/g" 112 | ExecuteCommand(LeftSpaceCommand) 113 | 114 | ; 在英文右边加空格 115 | RightSpaceCommand := "%s/([A-Za-z0-9%``])([^A-z0-9 -@.:<>!\/\[\](){}|'`,。!、;:“‘()])/$1 $2/g" 116 | ExecuteCommand(RightSpaceCommand) 117 | 118 | ; 恢复之前的输入法 119 | SetIME(CurrentIME, hWnd) 120 | Return 121 | 122 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 123 | ; 函数 ; 124 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 125 | 126 | ; 在Obsidian中执行自定义操作 127 | ; 注意必须处于vim模式当中 128 | ExecuteCommand(Command) { 129 | Clipboard := Command 130 | Send {Esc} ; 进入正常模式 131 | Send {RShift}{:} ; 进入命令模式 132 | Send ^v ; Ctrl+V,粘贴 133 | Send {Enter 1} ; 执行 134 | Send {Esc} ; 进入正常模式 135 | Clipboard := 136 | } 137 | 138 | -------------------------------------------------------------------------------- /scripts/StringFinderHotKey.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 打开 String Finder 后,按快捷键搜索 3 | ; 4 | ; Ctrl+Enter: 搜索 5 | ; 6 | ; gaochao.morgen@gmail.com 7 | ; 2017/3/17 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | 10 | #Include ../lib/SystemCursor.ahk 11 | 12 | #Persistent 13 | #SingleInstance Force 14 | #NoTrayIcon 15 | #NoEnv 16 | 17 | ; Ctrl + Enter 18 | #IfWinActive ahk_class #32770 19 | ^Enter:: 20 | WinMaximize 21 | ControlClick, Button1 ; 点击"开始"进行搜索 22 | 23 | ; 等待搜索结果 24 | WinWait, Findstr 25 | { 26 | ;MsgBox, YES 27 | ControlClick, Button2 ; 点击"否" 28 | Sleep, 800 29 | WinActivate, String Finder 30 | } 31 | 32 | SystemCursor("Off") 33 | ; 不知道什么原因,在WinWait之后就无法获取控件坐标了 34 | ;;;ControlGetPos, X, Y, W, H, SysHeader321 ; , ahk_class #32770; 标题栏控件坐标 35 | ;;;;MsgBox, %X% + %Y% + %W% + %H% 36 | ;;;MouseMove, % X+579, % Y+5 ; 控件分隔处 37 | MouseMove, 596, 429 38 | Send {LButton 2} ; 双击,长度最大化 39 | SystemCursor("On") 40 | Return 41 | 42 | -------------------------------------------------------------------------------- /scripts/TODO LIST.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 在桌面显示TODO LIST 3 | ; 4 | ; 用法: 首次点击按钮更新TODO条目,再次点击按钮保存并显示为背景透明 5 | ; 6 | ; 快捷键: 7 | ; Enter: 保存 8 | ; Ctrl + Enter: 文本换行 9 | ; 10 | ; NOTE: 11 | ; 本程序将Edit控件设置为透明. 当点击Edit控件时,在Edit空白区域会穿透控件,导致事件无法触发 12 | ; 虽然点击Edit控件文字部分有时候会触发事件,但有时候不能触发,完全取决于点击的位置 13 | ; 因此设置了按钮使Edit控件临时变得不透明,以便更新条目,更新完毕再次点击按钮变成透明显示 14 | ; 15 | ; 修改自Uberi的To-Do List / Reminders 16 | ; URL: http://www.autohotkey.com/board/topic/57455-to-do-list-reminders 17 | ; 18 | ; gaochao.morgen@gmail.com 19 | ; 2014/5/24 20 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 21 | 22 | #Persistent 23 | #SingleInstance Force 24 | #NoTrayIcon 25 | #NoEnv 26 | 27 | #Include ../lib/DpiScale.ahk 28 | 29 | ; 若配置文件目录不存在,则创建 30 | ConfigPath = %A_ScriptDir%\..\config 31 | if (!IsDirExist(ConfigPath)) 32 | FileCreateDir, %ConfigPath% 33 | 34 | ; 若配置文件不存在,则创建空白文件 35 | ConfigFile = %ConfigPath%\TODO.config 36 | IfNotExist, %ConfigFile% 37 | FileAppend,, %ConfigFile% 38 | 39 | WINDOW_X := A_ScreenWidth - (380*GetDpiScale()) ; 窗口起始X 40 | WINDOW_Y := 250 * GetDpiScale() ; 窗口起始Y 41 | WINDOW_W := 250 ; 窗口宽度 42 | WINDOW_H := 300 ; 窗口高度 43 | EDIT_H := 20 ; Edit控件高度 44 | EDIT_SPACE := 1 ; Edit控件垂直间距 45 | TEXT_W := 18 ; Text控件宽度 46 | BUTTON_H := 20 ; Button控件高度 47 | BUTTON_SPACE := 7 ; Button控件与Edit控件的垂直间距 48 | BGCOLOR = 00FF00 ; 背景颜色RGB 49 | 50 | FieldCount := Round((WINDOW_H-BUTTON_H-BUTTON_SPACE) / (EDIT_H+EDIT_SPACE)) ; TODOLIST最大条目为FieldCount条 51 | 52 | Changed := false ; 记录窗口是否激活 53 | LastField = 0 ; 记录最后一个显示出来的Edit控件索引 54 | 55 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 56 | ; GUI ; 57 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 58 | 59 | CoordMode, Mouse 60 | Gui, -Caption +ToolWindow +LastFound 61 | Gui, Margin, 0, 0 62 | 63 | Gui, Color, %BGCOLOR% ; 窗口背景颜色 64 | WinSet, Transparent, Off ; 窗口设置为不透明 65 | WinSet, TransColor, %BGCOLOR% 255 ; 让窗口中指定颜色的所有像素透明 66 | 67 | Gui, Font, cRed S9, Arial 68 | Gui, Add, Button, x%TEXT_W% h%BUTTON_H% +0x8000 HwndHwndButton gBtClick, TODO LIST 69 | 70 | ; 添加所有Edit控件 71 | Gui, Font, cRed S10 underline, SIMSUN 72 | Loop, %FieldCount% 73 | { 74 | ; 相对于窗口的坐标 75 | Coordinate := " x" . TEXT_W 76 | Coordinate .= " y" . (A_Index * (EDIT_H+EDIT_SPACE) + BUTTON_SPACE) 77 | Coordinate .= " w" . WINDOW_W - TEXT_W 78 | Coordinate .= " h" . EDIT_H 79 | 80 | Style := Coordinate 81 | Style .= " Hidden -E0x200 " ; E0x200 = WS_EX_CLIENTEDGE 82 | Style .= " vField" . A_Index 83 | Style .= " HwndHwndField" . A_Index 84 | Gui, Add, Edit, %Style% 85 | 86 | Gui, Color,, %BGCOLOR% ; 控件背景颜色 87 | Gui +LastFound ; 刚刚创建的Edit控件 88 | WinSet, TransColor, %BGCOLOR% 255 ; 控件设置为透明 89 | } 90 | 91 | ; 添加索引 92 | Gui, Font ; 先恢复默认字体,再设置字体,否则仍然会有下划线 93 | Gui, Font, cRed 94 | Loop, %FieldCount% 95 | { 96 | Coordinate := " x0" 97 | Coordinate .= " y" . (A_Index * (EDIT_H+EDIT_SPACE) + BUTTON_SPACE) 98 | Coordinate .= " w" . TEXT_W 99 | Coordinate .= " h" . EDIT_H 100 | 101 | Style := Coordinate 102 | Style .= " Hidden +0x2" 103 | Style .= " vIndex" . A_Index 104 | 105 | Gui, Add, Text, %Style%, % A_Index . "." 106 | } 107 | 108 | Gui, Show, x%WINDOW_X% y%WINDOW_Y% w%WINDOW_W% h%WINDOW_H%, TODOLIST 109 | 110 | SetFormat, Integer, Hex 111 | OnMessage(0x111, "ClickedEdit") 112 | Gosub, Load 113 | OnExit, GuiClose 114 | Return 115 | 116 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 117 | ; 主画面响应 ; 118 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 119 | 120 | ; 加载文件内容到TODOLIST 121 | Load: 122 | Critical ; 防止当前线程被其他线程中断 123 | SetFormat, Integer, D ; 运算结果为10进制 124 | 125 | IfNotExist, %ConfigFile% 126 | { 127 | AddNewField() 128 | HideEditBorder(LastField) 129 | GuiControl,, Field1, 点击按钮添加新条目 130 | Return 131 | } 132 | 133 | LineCount := 0 134 | Loop, Read, %ConfigFile% 135 | { 136 | ; 跳过空行 137 | pos := RegExMatch(A_LoopReadLine, "^([ \t]*)$") 138 | if (ErrorLevel = 0 && pos > 0) 139 | continue 140 | 141 | LineCount++ 142 | AddNewField() 143 | GuiControl,, Field%LineCount%, %A_LoopReadLine% 144 | } 145 | 146 | if (LineCount = 0) 147 | { 148 | AddNewField() 149 | HideEditBorder(LastField) 150 | GuiControl,, Field1, 点击按钮添加新条目 151 | } 152 | else 153 | { 154 | ClearEmptyFields() 155 | Loop %FieldCount% 156 | HideEditBorder(A_Index) 157 | } 158 | Return 159 | 160 | ; 将TODOLIST中的内容保存到文件 161 | Save: 162 | Critical 163 | SetFormat, Integer, D 164 | NewFileContent = 165 | Loop, %LastField% 166 | { 167 | GuiControlGet, EditContent,, Field%A_Index% 168 | NewFileContent .= EditContent . "`n" 169 | } 170 | StringTrimRight, NewFileContent, NewFileContent, 1 171 | IfExist, %ConfigFile% 172 | FileDelete, %ConfigFile% 173 | FileAppend, %NewFileContent%, %ConfigFile% 174 | Return 175 | 176 | ; 修改TODOLIST的内容 177 | ; 首次点击时,Edit控件将处于激活状态,允许添加新的TODO条目 178 | ; 再次点击时,Edit控件将处于非激活状态(只是变透明了,实际上还是激活的) 179 | BtClick: 180 | if (!Changed) 181 | { 182 | Gui, Color,, cDefault ; 设置控件背景颜色为默认颜色,使他们不再透明 183 | Loop, %LastField% ; 为当前可见的所有Edit控件设置边框 184 | ShowEditBorder(A_Index) 185 | AddNewField() ; 加一行空行,以便添加新内容 186 | GuiControl, Focus, % HwndField%LastField% 187 | } 188 | else 189 | { 190 | Gui, Color,, %BGCOLOR% ; 设置控件背景颜色,使他们再次透明 191 | Loop, %FieldCount% ; 隐藏所有Edit控件的边框 192 | HideEditBorder(A_Index) 193 | ClearEmptyFields() 194 | Gosub, Save 195 | } 196 | 197 | Changed := !Changed 198 | Return 199 | 200 | ; 保存并退出程序 201 | GuiClose: 202 | Gosub, Save 203 | ExitApp 204 | Return 205 | 206 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 207 | ; 热键 ; 208 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 209 | 210 | ; 回车保存. 仅在处于激活状态时才有效 211 | #IfWinActive TODOLIST 212 | Enter:: 213 | if (!Changed) 214 | Return 215 | 216 | Gui, Submit, Nohide 217 | Gui, Color,, %BGCOLOR% ; 设置控件背景颜色,使他们再次透明 218 | Loop, %FieldCount% ; 隐藏所有Edit控件的边框 219 | HideEditBorder(A_Index) 220 | ClearEmptyFields() 221 | Gosub, Save 222 | Changed := false 223 | Return 224 | #IfWinActive 225 | 226 | ; Ctrl + Enter 换行 227 | #IfWinActive TODOLIST 228 | ^Enter:: 229 | Gosub, Save 230 | FocusIndex := LastField 231 | GuiControl, Focus, % HwndField%FocusIndex% 232 | AddNewField() 233 | GuiControl, Focus, % HwndField%FocusIndex% 234 | Return 235 | #IfWinActive 236 | 237 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 238 | ; 函数 ; 239 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 240 | 241 | ; 判断目录是否存在 242 | IsDirExist(DirName) 243 | { 244 | if (FileExist(DirName)) 245 | { 246 | if InStr(FileExist(DirName), "D") 247 | return true 248 | } 249 | 250 | return false 251 | } 252 | 253 | ; 给Edit控件加上边框 254 | ShowEditBorder(EditIndex) 255 | { 256 | EditHwnd := HwndField%EditIndex% 257 | ; 0x800000 = WS_BORDER = Border 258 | Control, Style, +0x800000,, ahk_id %EditHwnd% 259 | ; 按理说设置样式后,紧跟着WinSet, Redraw就可以了, 但是测试不行 260 | ; 但先禁用后启用,则可以 261 | Control, Disable,,, ahk_id %EditHwnd% 262 | Control, Enable,,, ahk_id %EditHwnd% 263 | } 264 | 265 | ; 去掉Edit控件的边框 266 | HideEditBorder(EditIndex) 267 | { 268 | EditHwnd := HwndField%EditIndex% 269 | Control, Style, -0x800000,, ahk_id %EditHwnd% 270 | Control, Disable,,, ahk_id %EditHwnd% 271 | Control, Enable,,, ahk_id %EditHwnd% 272 | } 273 | 274 | ; 点击最后一个Edit控件时,产生一个新的Edit控件 275 | ClickedEdit(wParam, lParam) 276 | { 277 | global 278 | wParam := (wParam&0xFFFF0000) >> 16 279 | if wParam = 0x100 280 | { 281 | if (lParam = HwndField%LastField%) 282 | AddNewField() 283 | } 284 | else if wParam = 0x200 285 | { 286 | ClearEmptyFields() 287 | AddNewField() 288 | } 289 | } 290 | 291 | ; 显示一个新的带边框Edit控件 292 | AddNewField() 293 | { 294 | global 295 | SetFormat, Integer, D 296 | if LastField = %FieldCount% 297 | Return 298 | LastField++ 299 | ShowEditBorder(LastField) 300 | GuiControl, Show, Field%LastField% 301 | GuiControl, Show, Index%LastField% 302 | } 303 | 304 | ; 隐藏所有内容为空的Edit控件 305 | ClearEmptyFields() 306 | { 307 | global 308 | SetFormat, Integer, D 309 | if LastField = 1 310 | Return 311 | 312 | VisiableField := LastField 313 | 314 | ; 处理到倒数第二行 315 | Loop, % VisiableField - 1 316 | { 317 | ; 碰到一个空行,则把其后的所有TODO条目均向上移动一行 318 | GuiControlGet, EditLine,, Field%A_Index% 319 | if EditLine = 320 | { 321 | A_Index1 = %A_Index% 322 | Loop, % VisiableField - A_Index1 323 | { 324 | A_Index1++ 325 | GuiControlGet, EditLine,, Field%A_Index1% 326 | GuiControl,, Field%A_Index1% 327 | GuiControl,, % "Field" . (A_Index1 - 1), %EditLine% 328 | } 329 | 330 | ; 空行被移动到了最后一行,因此将最后一行隐藏 331 | GuiControl, Hide, Field%LastField% 332 | GuiControl, Hide, Index%LastField% 333 | LastField-- 334 | } 335 | } 336 | 337 | ; 最后一行若为空行,则直接隐藏 338 | GuiControlGet, EditLine,, Field%LastField% 339 | if EditLine = 340 | { 341 | GuiControl, Hide, Field%LastField% 342 | GuiControl, Hide, Index%LastField% 343 | LastField-- 344 | } 345 | } 346 | 347 | -------------------------------------------------------------------------------- /scripts/Win11中文输入法.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 调整微软拼音输入法,用键盘的`/`键输出中文顿号`、` 3 | ; 源自:https://blog.csdn.net/goocheez/article/details/132899579 4 | ; 我将其转换为了AHK的旧语法 5 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 6 | 7 | #SingleInstance, Force 8 | #NoTrayIcon 9 | #NoEnv 10 | 11 | is_chinese_mode() { 12 | WinGet, hWnd, ID, A 13 | 14 | origin_detect_hidden_window := A_DetectHiddenWindows 15 | DetectHiddenWindows, On 16 | 17 | ; 获取当前输入法窗口句柄 18 | IMEWnd := DllCall("imm32\ImmGetDefaultIMEWnd", "UInt", hWnd, "UInt") 19 | 20 | ; 使用 DllCall 调用 SendMessage 21 | result := DllCall("SendMessage", "UInt", IMEWnd, "UInt", 0x283, "UInt", 0x001, "UInt", 0) 22 | 23 | DetectHiddenWindows, %origin_detect_hidden_window% 24 | 25 | ; 微软拼音(英-中,新/旧,新旧/新旧)0/1024-1/1025 26 | return (result == 1 or result == 1025) 27 | } 28 | 29 | $/:: 30 | { 31 | if (is_chinese_mode()) { 32 | SendInput, \ 33 | } else { 34 | SendInput, / 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /scripts/单词统计.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 统计字符数. 小众计数器未提供源码,自己实现 3 | ; 4 | ; F12: 统计当前选中文字中的中英文单词数 5 | ; 6 | ; gaochao.morgen@gmail.com 7 | ; 2015/6/21 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | 10 | #Persistent 11 | #SingleInstance Force 12 | #NoTrayIcon 13 | #NoEnv 14 | 15 | ; 英文标点符号 16 | global Symbols := "^[:;,_!'\-\\\.\*\?\+\[\{\|\(\)\^\$]" 17 | global ToolTipX := A_ScreenWidth / 2 18 | global ToolTipY := A_ScreenHeight / 2 19 | 20 | F12:: 21 | ClipSaved := ClipboardAll ; 保存剪切板的内容 22 | 23 | ; 把当前选中的文本拷贝到剪切板,然后统计剪切板的内容 24 | ClipBoard := 25 | Send ^c 26 | ClipWait, 5 27 | 28 | ChCount := ChineseCount(ClipBoard) 29 | EnCount := EnglishCount(ClipBoard) 30 | 31 | ClipBoard := ClipSaved ; 恢复剪切板的内容 32 | 33 | ToolTip, % ShowResult(ChCount, EnCount), %ToolTipX%, %ToolTipY% 34 | SetTimer, RemoveToolTip, 3000 35 | Return 36 | 37 | RemoveToolTip: 38 | SetTimer, RemoveToolTip, Off 39 | ToolTip 40 | Return 41 | 42 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 43 | ; 函数 ; 44 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 45 | 46 | ; 统计中文字符 47 | ChineseCount(Input) 48 | { 49 | Count := 0 50 | 51 | ; AHKL对一个UTF-8编码的汉字,会循环2次 52 | Loop, Parse, Input 53 | { 54 | if A_LoopField is alnum ; 仅当A_LoopField包含[0-9a-zA-Z]时为真 55 | { 56 | continue 57 | } 58 | else if A_LoopField is space 59 | { 60 | continue 61 | } 62 | else 63 | { 64 | pos := RegExMatch(A_LoopField, Symbols) 65 | if (ErrorLevel = 0 && pos > 0) 66 | continue 67 | else 68 | Count := Count + 1 69 | } 70 | } 71 | 72 | Return Count 73 | } 74 | 75 | ; 统计英文字符 76 | EnglishCount(Input) 77 | { 78 | StringReplace, Input, Input, ', x, All ; It's -> Itxs,视为一个单词 79 | StringReplace, Input, Input, -, x, All ; well-defined -> wellxdefined,视为一个单词 80 | RegExReplace(Input, "\w+", "", Count) ; PhiLho 81 | 82 | Return Count 83 | } 84 | 85 | ; 显示统计结果 86 | ShowResult(ChCount, EnCount) 87 | { 88 | Result := "中文: " 89 | Result .= ChCount 90 | Result .= "`r`n" 91 | Result .= "英文: " 92 | Result .= EnCount 93 | Result .= "`r`n" 94 | Result .= "总共: " 95 | Result .= ChCount + EnCount 96 | 97 | Return Result 98 | } 99 | 100 | -------------------------------------------------------------------------------- /scripts/双击关闭Chrome标签页.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 在Chrome浏览器的标签上双击,关闭该标签页 3 | ; 不过目前仍有一点问题,不在标签页上双击,在浏览器标题栏空白处双击,仍然会关闭激活的标签页,无法解决 4 | ; 5 | ; gaochao.morgen@gmail.com 6 | ; 2019/11/12 7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 8 | 9 | #Include ../lib/DpiScale.ahk 10 | 11 | #SingleInstance Force ; 跳过对话框并自动替换旧实例 12 | #NoTrayIcon 13 | #NoEnv ; 不检查空变量是否为环境变量(建议所有新脚本使用) 14 | 15 | ; 双击标签关闭标签页(模拟Ctrl+W键) 16 | ; 如果是Chrome浏览器(最大化状态),且鼠标y轴小于34,则判定为鼠标位于标签页上 17 | #IfWinActive ahk_class Chrome_WidgetWin_1 18 | ~LButton:: 19 | ; 如果未处于最大化状态,则不起作用 20 | WinGet, state, MinMax 21 | if (state != 1) { 22 | Return 23 | } 24 | 25 | ; 仅在最大化时起作用 26 | CoordMode, Mouse, Screen 27 | MouseGetPos, X, Y 28 | Y := Y / GetDpiScale() ; 考虑系统缩放对UI显示的影响 29 | if (Y <= 34) { 30 | if (A_ThisHotkey = A_PriorHotkey && A_TimeSincePriorHotkey < 600) { 31 | Send, ^w 32 | } 33 | } 34 | Return 35 | 36 | -------------------------------------------------------------------------------- /scripts/我的电脑.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 打开我的电脑,并且不选中"文件夹" 3 | ; 4 | ; Win + E: 打开我的电脑 5 | ; 6 | ; gaochao.morgen@gmail.com 7 | ; 2014/2/4 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | 10 | #SingleInstance Force 11 | #NoTrayIcon 12 | #NoEnv 13 | 14 | ; Win + E 15 | #e:: 16 | Run, ::{20d04fe0-3aea-1069-a2d8-08002b30309d},, Max 17 | Return 18 | -------------------------------------------------------------------------------- /scripts/截图.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 鼠标选定区域,截取该区域 3 | ; 4 | ; Ctrl + Shift + 左键: 截图存为PNG图片,并保存到桌面 5 | ; Ctrl + Shift + 右键: 截图保存到ClipBoard中,直接粘贴 6 | ; 7 | ; 已知BUG: 用WinSet设置了TransColor的窗口无法捕捉 8 | ; 9 | ; gaochao.morgen@gmail.com 10 | ; 2014/2/12 11 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 12 | 13 | #Include ../lib/Gdip.ahk 14 | #Include ../lib/DpiScale.ahk 15 | 16 | #SingleInstance, Force 17 | #NoTrayIcon 18 | #NoEnv 19 | 20 | SetBatchLines, -1 ; 让脚本以全速运行 21 | 22 | +^LButton:: 23 | screen := MouseCapture("LButton") 24 | 25 | FormatTime, TimeString, A_Now, yyyy-MM-dd HH-mm-ss 26 | output := A_Desktop . "\" . TimeString . ".png" 27 | 28 | ; Start gdi+ 29 | If !pToken := Gdip_Startup() 30 | { 31 | MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system 32 | Return 33 | } 34 | 35 | pbitmap:=Gdip_BitmapFromScreen(screen) 36 | Gdip_SaveBitmapToFile(pBitmap, output) 37 | Gdip_DisposeImage(pBitmap) 38 | Gdip_Shutdown(pToken) 39 | Return 40 | 41 | +^RButton:: 42 | screen := MouseCapture("RButton") 43 | 44 | ; Start gdi+ 45 | If !pToken := Gdip_Startup() 46 | { 47 | MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system 48 | Return 49 | } 50 | 51 | pbitmap:=Gdip_BitmapFromScreen(screen) 52 | Gdip_SetBitmapToClipboard(pBitmap) 53 | Gdip_DisposeImage(pBitmap) 54 | Gdip_Shutdown(pToken) 55 | Return 56 | 57 | MouseCapture(BUTTON) 58 | { 59 | CoordMode, Mouse, Screen ; 屏幕绝对坐标模式,作用于MouseGetPos 60 | MouseGetPos, MX, MY 61 | Gui, 1:Color, EEAA99 62 | Gui, 1:+Lastfound 63 | WinSet, TransColor, EEAA99 64 | Gui, 1:-Caption +Border 65 | Loop 66 | { 67 | if GetKeyState(BUTTON, "P") 68 | { 69 | MouseGetPos, MXend, MYend 70 | W := abs(MX - MXend) 71 | H := abs(MY - MYend) 72 | DispW := W / GetDpiScale() 73 | DispH := H / GetDpiScale() 74 | if (MX < MXend) 75 | X := MX 76 | else 77 | X := MXend 78 | if (MY < MYend) 79 | Y := MY 80 | else 81 | Y := MYend 82 | 83 | Gui, 1:Show, x%X% y%Y% w%DispW% h%DispH% 84 | } 85 | else 86 | Break 87 | } 88 | MouseGetPos, MXend, MYend 89 | Gui, 1:Destroy 90 | 91 | selection = %MX%|%MY%|%W%|%H% 92 | Return selection 93 | } 94 | 95 | -------------------------------------------------------------------------------- /scripts/自动关闭QQ弹窗.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 自动关闭QQ右下角弹窗 3 | ; 4 | ; 稻米鼠的板块 5 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 6 | 7 | #Persistent 8 | #SingleInstance Force 9 | #NoTrayIcon 10 | #NoEnv 11 | 12 | ; 若配置文件目录不存在,则创建 13 | LogPath = %A_ScriptDir%\..\log 14 | if (!IsDirExist(LogPath)) 15 | FileCreateDir, %LogPath% 16 | 17 | ; 日志文件 18 | LogFile = %LogPath%\QQPopLog.txt 19 | 20 | SetTimer, KillQQPop, 1000 21 | return 22 | 23 | KillQQPop: 24 | IfWinExist, ahk_class TXGuiFoundation 25 | { 26 | ;sleep 1000 27 | WinGetPos, Xpos, Ypos, Width, Height 28 | if (Width < 400 AND A_ScreenWidth <(Xpos + 500) AND A_ScreenHeight <(Ypos + 500)) 29 | { 30 | WinGetTitle, Title 31 | if (StrLen(Title)!= 0 AND Title!= "QQ" AND !(Title~="@") AND !(Title~="(") AND !(Title="TXMenuWindow")) 32 | { 33 | WinClose 34 | ;TrayTip,喵了腾讯, 关闭了 %Title% 35 | file := FileOpen(LogFile, "a") 36 | file.WriteLine(A_YYYY " " A_MM " " A_DD " " A_Hour ":" A_Min ":" A_Sec " —— " Title "`n`r") 37 | file.Close() 38 | ;sleep 1000 39 | ;TrayTip 40 | } 41 | } 42 | } 43 | Return 44 | 45 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 46 | ; 函数 ; 47 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 48 | 49 | ; 判断目录是否存在 50 | IsDirExist(DirName) 51 | { 52 | if (FileExist(DirName)) 53 | { 54 | if InStr(FileExist(DirName), "D") 55 | return true 56 | } 57 | 58 | return false 59 | } 60 | 61 | -------------------------------------------------------------------------------- /scripts/锁屏.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ; 一键锁屏并让屏幕关闭,节约用电 3 | ; 4 | ; Win + L: 锁屏并关闭屏幕 5 | ; 6 | ; gaochao.morgen@gmail.com 7 | ; 2014/2/4 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | 10 | #SingleInstance Force 11 | #NoTrayIcon 12 | #NoEnv 13 | 14 | ; Win + L 15 | #l:: 16 | ; Lock Screen. 模拟Win+L没有成功,执行后Win似乎一直处于按下状态 17 | Run, %A_WinDir%\System32\rundll32.exe user32.dll LockWorkStation 18 | 19 | Sleep, 500 20 | 21 | ; Power off the screen 22 | ; 0x112: WM_SYSCOMMAND 23 | ; 0xF170: SC_MONITORPOWER 24 | ; 2: the display is being shut off 25 | SendMessage, 0x112, 0xF170, 2,, Program Manager 26 | Return 27 | -------------------------------------------------------------------------------- /setup/AutoHotkey.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/setup/AutoHotkey.chm -------------------------------------------------------------------------------- /setup/AutoHotkey111401_Install.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/setup/AutoHotkey111401_Install.exe -------------------------------------------------------------------------------- /testfile/ANSI.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/testfile/ANSI.txt -------------------------------------------------------------------------------- /testfile/UTF-8+BOM.txt: -------------------------------------------------------------------------------- 1 | PMTBLOWFLOW (模型) 2 | PMTBLOWTIME1 (模型) 3 | PMTBLOWTIME2 (模型) 4 | PMTBLOWTIME3 (模型) 5 | PMTBLOWTIME4 (模型) 6 | PMTBLOWTIME5 (模型) 7 | PMTCONST (模型) 8 | PMTFLUXHEAT (模型) 9 | PMTGROUP1 (模型) 脱氧钢种组参数 10 | PMTGROUP2 (模型) 渣钢种组参数 11 | PMTGROUP3 (模型) 粗调钢种组参数 12 | PMTGROUP4 (模型) 收得率钢种组参数 13 | PMTGROUP5 (模型) 14 | PMTGROUP6 (模型) 喂丝钢种组参数 15 | PMTHEATCURVE (模型) 16 | PMTREDUCE (模型) 17 | PMTSLAG1 (模型) 18 | PMTSLAG2 (模型) 19 | PMTSUP1 (模型) 目标成分补偿(连浇第一炉) 20 | PMTSUP2 (模型) 目标成分补偿(连浇第一炉以后) 21 | LMODELRESULT (模型) 22 | LMODELSTART (模型) 23 | LRESULTALLOY1 (模型) 24 | LRESULTALLOY2 (模型) 25 | LRESULTALLOY3 (模型) 26 | LRESULTALLOY4 (模型) 27 | LRESULTBLOW (模型) 28 | LRESULTCONT1 (模型) 29 | LRESULTCONT2 (模型) 30 | LRESULTFLUX (模型) 31 | LRESULTHEAT1 (模型) 32 | LRESULTHEAT2 (模型) 33 | LRESULTHEAT3 (模型) 34 | LRESULTLEARN (模型) 35 | LRESULTPRAC (模型) 36 | -------------------------------------------------------------------------------- /testfile/UTF-8.txt: -------------------------------------------------------------------------------- 1 | PMTBLOWFLOW (模型) 2 | PMTBLOWTIME1 (模型) 3 | PMTBLOWTIME2 (模型) 4 | PMTBLOWTIME3 (模型) 5 | PMTBLOWTIME4 (模型) 6 | PMTBLOWTIME5 (模型) 7 | PMTCONST (模型) 8 | PMTFLUXHEAT (模型) 9 | PMTGROUP1 (模型) 脱氧钢种组参数 10 | PMTGROUP2 (模型) 渣钢种组参数 11 | PMTGROUP3 (模型) 粗调钢种组参数 12 | PMTGROUP4 (模型) 收得率钢种组参数 13 | PMTGROUP5 (模型) 14 | PMTGROUP6 (模型) 喂丝钢种组参数 15 | PMTHEATCURVE (模型) 16 | PMTREDUCE (模型) 17 | PMTSLAG1 (模型) 18 | PMTSLAG2 (模型) 19 | PMTSUP1 (模型) 目标成分补偿(连浇第一炉) 20 | PMTSUP2 (模型) 目标成分补偿(连浇第一炉以后) 21 | LMODELRESULT (模型) 22 | LMODELSTART (模型) 23 | LRESULTALLOY1 (模型) 24 | LRESULTALLOY2 (模型) 25 | LRESULTALLOY3 (模型) 26 | LRESULTALLOY4 (模型) 27 | LRESULTBLOW (模型) 28 | LRESULTCONT1 (模型) 29 | LRESULTCONT2 (模型) 30 | LRESULTFLUX (模型) 31 | LRESULTHEAT1 (模型) 32 | LRESULTHEAT2 (模型) 33 | LRESULTHEAT3 (模型) 34 | LRESULTLEARN (模型) 35 | LRESULTPRAC (模型) 36 | -------------------------------------------------------------------------------- /testfile/Unicode.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/morgengc/AhkScriptManager/4c2bacfb76e3ae600c579a17d125c0aa8402cb13/testfile/Unicode.txt -------------------------------------------------------------------------------- /testfile/file.txt: -------------------------------------------------------------------------------- 1 | hiddenhausen,99.60,y 2 | herbstein,99.021,n 3 | bangalore,98.82,y 4 | golm,98.8,y 5 | para,98.82,n 6 | bogen,98.61,n 7 | saintandre,98.5,n 8 | delhi,98.61,y 9 | hyderabad,99.02,y --------------------------------------------------------------------------------