-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
385 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,34 @@ | ||
# hui-Zz的AutoHotkey脚本分享 | ||
|
||
## game 游戏相关脚本 | ||
|
||
- dm例子.ahk | ||
|
||
## img 图片处理脚本 | ||
|
||
- win10锁屏图片获取.ahk | ||
- 颜色神偷.ahk | ||
|
||
## key 热键相关脚本 | ||
|
||
- Zz_Keyboard.ahk:定时提醒和集中使用其他脚本 | ||
- Zz_Window.ahk:窗口快捷操作脚本 | ||
- Zz_key_vim.ahk:左Alt键搭配的Vim热键 | ||
- Zz_MButton.ahk:鼠标中键自由拖拽窗口 | ||
|
||
## mouse 鼠标相关脚本 | ||
|
||
- CtrlClick.ahk:连续Ctrl+左键后台打开网页 | ||
- LoopClick.ahk:循环鼠标双击连点 | ||
|
||
## program 程序相关脚本 | ||
|
||
- gitbook文件树生成SUMMARY.ahk | ||
- url一键批量下载.ahk | ||
|
||
## sys 系统相关脚本 | ||
|
||
- Oracle完全重启.ahk | ||
- ping.ahk | ||
- PPPoE自动宽带拔号.ahk | ||
- 任务栏音量.ahk |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#SingleInstance,Force ;~运行替换旧实例 | ||
F12:: | ||
Run,regsvr32 dm.dll ;~ /s无声 | ||
return | ||
F1:: ;~ 找图 | ||
dm:=ComObjCreate("dm.dmsoft") ;~ 调用大漠 | ||
;~ MsgBox,% dm.Ver() | ||
dmSetPath:=dm.GetBasePath() ;~ dm.dll路径 | ||
dm_ret:=dm.SetPath(dmSetPath) ;~ 设置默认路径 | ||
hwnd:=dm.GetForegroundWindow() ;~ 绑定窗口句柄 | ||
;~ hwnd:=dm.GetMousePointWindow() | ||
;~ 设置后台操作模式 | ||
dm_ret:=dm.BindWindow(hwnd,"dx2","normal","windows",0) | ||
;~ dm_ret:=dm.BindWindow(hwnd,"gdi","normal","normal",0) | ||
;~ dm_ret:=dm.BindWindow(hwnd, "dx2", "windows3", "windows", 0) | ||
If dm_ret=0 | ||
MsgBox,"绑定失败" | ||
SetTimer,t,800 | ||
return | ||
|
||
F2:: ;~ 截图 | ||
dm := ComObjCreate("dm.dmsoft") | ||
dm_ret := dm.SetPath("z:") | ||
hwnd := dm.GetMousePointWindow() | ||
dm_ret := dm.BindWindow(hwnd,"normal","normal","windows",0) | ||
dm_ret := dm.Capture(0,0,1366,768,"screen.bmp") | ||
dm_ret := dm.UnBindWindow() | ||
return | ||
|
||
t: | ||
dm_ret:=dm.FindPic(0,0,1366,768,"z.bmp","000000",0.8,0,intx,inty) ;~ 找图 | ||
;~ MouseMove, %intx%, %inty% ;~ 移动到图片坐标 | ||
ToolTip,% dm_ret | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
SourcePath := A_AppData . "\..\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets\" | ||
SavePath := A_MyDocuments . "\..\Pictures\lockimg\" | ||
IfNotExist, % SavePath | ||
FileCreateDir, % SavePath | ||
pToken := Gdip_Startup() | ||
|
||
Loop, Files, % SourcePath . "*" | ||
{ | ||
img := Gdip_CreateBitmapFromFile(A_LoopFileFullPath) | ||
w := Gdip_GetImageWidth(img) | ||
if ( w > 800 ) | ||
h := Gdip_GetImageHeight(img) | ||
else | ||
Continue | ||
if ( w > h ) | ||
FileCopy, % A_LoopFileFullPath, % SavePath . A_LoopFileName . ".jpg" | ||
|
||
} | ||
|
||
Gdip_Shutdown(pToken) | ||
|
||
; º¯ÊýÁбí | ||
Gdip_Startup() | ||
{ | ||
Ptr := A_PtrSize ? "UPtr" : "UInt" | ||
|
||
if !DllCall("GetModuleHandle", "str", "gdiplus", Ptr) | ||
DllCall("LoadLibrary", "str", "gdiplus") | ||
VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1) | ||
DllCall("gdiplus\GdiplusStartup", A_PtrSize ? "UPtr*" : "uint*", pToken, Ptr, &si, Ptr, 0) | ||
return pToken | ||
} | ||
|
||
Gdip_Shutdown(pToken) | ||
{ | ||
Ptr := A_PtrSize ? "UPtr" : "UInt" | ||
|
||
DllCall("gdiplus\GdiplusShutdown", Ptr, pToken) | ||
if hModule := DllCall("GetModuleHandle", "str", "gdiplus", Ptr) | ||
DllCall("FreeLibrary", Ptr, hModule) | ||
return 0 | ||
} | ||
|
||
Gdip_CreateBitmapFromFile(sFile, IconNumber=1, IconSize="") | ||
{ | ||
Ptr := A_PtrSize ? "UPtr" : "UInt" | ||
PtrA := A_PtrSize ? "UPtr*" : "UInt*" | ||
DllCall("gdiplus\GdipCreateBitmapFromFile", Ptr, &sFile, PtrA, pBitmap) | ||
return pBitmap | ||
} | ||
|
||
Gdip_GetImageWidth(pBitmap) | ||
{ | ||
DllCall("gdiplus\GdipGetImageWidth", A_PtrSize ? "UPtr" : "UInt", pBitmap, "uint*", Width) | ||
return Width | ||
} | ||
|
||
Gdip_GetImageHeight(pBitmap) | ||
{ | ||
DllCall("gdiplus\GdipGetImageHeight", A_PtrSize ? "UPtr" : "UInt", pBitmap, "uint*", Height) | ||
return Height | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
F1:: ;<--颜色神偷 | ||
MouseGetPos,mouseX,mouseY | ||
PixelGetColor,color,%mouseX%,%mouseY%,RGB | ||
StringRight,color,color,6 | ||
clipboard=%color% | ||
FileAppend,%color%(%mouseX%`,%mouseY%)`n,Z:\color.txt | ||
ToolTip,%color%`n%mouseX% %mouseY% | ||
SetTimer,RemoveToolTip,3000 | ||
MouseMove,0,0 | ||
PixelGetColor,co,%mouseX%,%mouseY%,RGB | ||
FileAppend,%co%`n`n,Z:\color.txt | ||
MouseMove,%mouseX%,%mouseY% | ||
Run,% "F:\Users\Windows\Notepad2.exe /o /p 1066,234,300,300 Z:\color.txt" | ||
return | ||
|
||
F2:: ;<--取当前鼠标下颜色 | ||
MouseGetPos,mouseX,mouseY | ||
PixelGetColor,color,%mouseX%,%mouseY%,RGB | ||
StringRight,color,color,6 | ||
clipboard=%color% | ||
FileAppend,%color%(%mouseX%`,%mouseY%)`n,Z:\color.txt | ||
ToolTip,%color%`n%mouseX% %mouseY% | ||
SetTimer,RemoveToolTip,3000 | ||
return | ||
|
||
F3:: ;<--取鼠标移开后颜色 | ||
PixelGetColor,co,%mouseX%,%mouseY%,RGB | ||
FileAppend,%co%`n`n,Z:\color.txt | ||
return | ||
|
||
RemoveToolTip: | ||
SetTimer,RemoveToolTip,Off | ||
ToolTip | ||
return |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
~^LButton:: | ||
Hotkey,LButton,CtrlLButton | ||
KeyWait,LButton | ||
Keywait,LButton,d,t0.2 | ||
if Errorlevel { | ||
Hotkey,LButton,Off | ||
}else{ | ||
Hotkey,LButton,On | ||
ToolTip,后台打开 | ||
SetTimer,RemoveToolTip,1000 | ||
} | ||
return | ||
CtrlLButton: | ||
Send,^{LButton} | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
;******************** | ||
; LWin+鼠标双击连点 | ||
;******************** | ||
RCtrl & LButton:: | ||
KeyWait,LButton | ||
KeyWait,LButton,d,t0.1 | ||
if Errorlevel | ||
SetTimer,zClick,1 | ||
else | ||
SetTimer,zClick,Off | ||
return | ||
zClick: | ||
Click | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
;**************************** | ||
;* gitbook文件树生成SUMMARY * | ||
;* by hui-Zz * | ||
;**************************** | ||
;~ InputBox, UserInput, 生成SUMMARY, 请输入gitbook的书库所在路径`n(不加引号,末尾不带\) | ||
;~ if !ErrorLevel | ||
;~ { | ||
|
||
;~ } | ||
|
||
UserInput=C:\Users\%A_UserName%\GitBook\Library\hui-zz\huinote | ||
ignoreList:=["SUMMARY.md",".gitignore","README.md","_book"] | ||
SummaryPath=%UserInput%\SUMMARY.md | ||
FileDelete,%SummaryPath% | ||
SummaryStr:="# Summary`n`n* [Introduction简介](README.md)" | ||
FileAppend,%SummaryStr%`n,%SummaryPath%,UTF-8 | ||
dirREADME:="" ;用于让README.md文件排序到目录第一 | ||
Loop Files, %UserInput%\*.*, R ; 递归子文件夹. | ||
{ | ||
ignoreFlag:=false | ||
For igk, igv in ignoreList | ||
{ | ||
if(InStr(A_LoopFileFullPath,UserInput "\" igv)) | ||
ignoreFlag:=true | ||
} | ||
if(ignoreFlag) | ||
continue | ||
SummaryStr:=SummarySpace:="" | ||
SplitPath, A_LoopFileFullPath, name, dir, ext, name_no_ext, drive | ||
if(InStr(dir,UserInput "\.git") || InStr(dir,UserInput "\assets")) | ||
continue | ||
pathStr:=StrReplace(A_LoopFileFullPath,UserInput "\") ;去掉书库路径 | ||
pathStr:=StrReplace(StrReplace(pathStr,name),"\","/") ;替换正反斜杠 | ||
pathArray:=StrSplit(pathStr, "/") ;用分隔符计算目录层级 | ||
Loop, % pathArray.MaxIndex() - 2 | ||
{ | ||
SummarySpace.=A_Space A_Space | ||
} | ||
if(pathStr="") { ;如果是根目录文件,直接添加 | ||
SummaryStr.=SummarySpace "* [" name_no_ext "](" pathStr name ")" | ||
}else if(name!="README.md") { | ||
if(dirREADME!=pathStr){ ;优先添加README.md在顶部,作标记用于后续比较 | ||
dirREADME:=pathStr | ||
lastSecond:=RegExReplace(A_LoopFileFullPath,"iS).*\\(.*?)\\.*?$","$1") | ||
SummaryStr.=SummarySpace "* [" lastSecond "](" pathStr "README.md)`n" | ||
} | ||
SummarySpace.=A_Space A_Space ;父目录下的非README.md多缩进两空格 | ||
SummaryStr.=SummarySpace "* [" name_no_ext "](" pathStr name ")" | ||
} else if(dirREADME!=pathStr){ ;第一个是README.md就添加,之前已经添加过README.md就不用重复添加 | ||
dirREADME:=pathStr | ||
lastSecond:=RegExReplace(A_LoopFileFullPath,"iS).*\\(.*?)\\.*?$","$1") | ||
SummaryStr:=SummarySpace "* [" lastSecond "](" pathStr "README.md)" | ||
} | ||
if(SummaryStr) | ||
FileAppend,%SummaryStr%`n,%SummaryPath%,UTF-8 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
╔══════════════════════════════════════════════════ | ||
║【url一键批量下载】 @2017.09.28 https://github.com/hui-Zz | ||
╚══════════════════════════════════════════════════ | ||
*/ | ||
Gui,Destroy | ||
Gui,+Resize | ||
Gui,Font,,Microsoft YaHei | ||
Gui,Margin,10,10 | ||
Gui,Add,Button,xm-5 yp+5 w35 h40 GSetDownPath,保存目录 | ||
Gui,Add,Edit,xm+35 yp+10 w600 r1 vvDownPath,%DownPath% | ||
Gui,Add,Button,xm-3 yp+35 w28 h120 GSetUrlPath,url地址文件 | ||
Gui,Add,Edit,xm+35 yp w600 r30 -Wrap HScroll vvUrlPath,%UrlPath% | ||
Gui,Font,Bold,Microsoft YaHei | ||
Gui,Add,Button,xm-3 yp+130 w28 h150 GDownUrl,开始批量下载! | ||
Gui,Add,Progress,xm+35 w600 cGreen vMyProgress | ||
GuiControl, Hide, MyProgress | ||
Gui, Show, , 【url一键批量下载】github.com/hui-Zz | ||
return | ||
GuiSize: | ||
if A_EventInfo = 1 | ||
return | ||
GuiControl, Move, vDownPath, % " W" . (A_GuiWidth - 50) | ||
GuiControl, Move, vMyProgress, % " W" . (A_GuiWidth - 50) | ||
GuiControl, Move, vUrlPath, % "H" . (A_GuiHeight-70) . " W" . (A_GuiWidth - 50) | ||
return | ||
SetDownPath: | ||
FileSelectFolder, saveFolder, , 3 | ||
GuiControl,, vDownPath, %saveFolder% | ||
return | ||
SetUrlPath: | ||
FileSelectFile, Urltxt, , , 选择要导入的url下载地址存储文件 | ||
;~;[读取url下载地址存储文件] | ||
FileRead, OutputVar, %Urltxt% | ||
GuiControl,, vUrlPath, %OutputVar% | ||
return | ||
DownUrl: | ||
Gui,Submit,NoHide | ||
StringReplace, OutReplace, vUrlPath, `n, `n, UseErrorLevel | ||
lineNum := ErrorLevel + !(OutReplace = "") | ||
MsgBox,33,批量下载文件,确定批量下载%lineNum%个文件? | ||
IfMsgBox Ok | ||
{ | ||
;~ 每次增加进度 := 向上取整(100%进度条/文件数) | ||
progressNum := Ceil(100 / lineNum) | ||
GuiControl, Show, MyProgress | ||
GuiControl,, MyProgress, 0 | ||
Loop,parse,vUrlPath,`n | ||
{ | ||
if(A_LoopField){ | ||
SplitPath, A_LoopField, name | ||
;~ URLDownloadToFile,%A_LoopField%,%vDownPath%\%name% | ||
URLDownloadToFile(A_LoopField,vDownPath . "\" . name) | ||
if(ErrorLevel=1){ | ||
MsgBox,%vDownPath%\%name% | ||
} | ||
GuiControl,, MyProgress, +%progressNum% | ||
} | ||
} | ||
TrayTip,,url一键批量下载完成,3,17 | ||
} | ||
return | ||
UrlDownloadToFile(URL,FilePath,Proxy="",ProxyBypassList="",Cookie="",Referer="",UserAgent="",EnableRedirects="",Timeout=-1) | ||
{ | ||
ComObjError(0) ;禁用 COM 错误通告。禁用后,检查 A_LastError 的值,脚本可以实现自己的错误处理 | ||
WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1") | ||
if (EnableRedirects<>"") | ||
WebRequest.Option(6):=EnableRedirects | ||
if (Proxy<>"") ;设置代理服务器。微软的代码 SetProxy() 是放在 Open() 之前的,所以我也放前面设置,以免无效 | ||
WebRequest.SetProxy(2,Proxy,ProxyBypassList) | ||
WebRequest.Open("GET", URL, true) ;true为异步获取,默认是false。龟速的根源!!!卡顿的根源!!! | ||
if (Cookie<>"") ;设置Cookie。SetRequestHeader() 必须 Open() 之后才有效 | ||
{ | ||
WebRequest.SetRequestHeader("Cookie","tuzi") ;先设置一个cookie,防止出错,见官方文档 | ||
WebRequest.SetRequestHeader("Cookie",Cookie) | ||
} | ||
if (Referer<>"") ;设置Referer | ||
WebRequest.SetRequestHeader("Referer",Referer) | ||
if (UserAgent<>"") ;设置User-Agent | ||
WebRequest.SetRequestHeader("User-Agent",UserAgent) | ||
WebRequest.Send() | ||
WebRequest.WaitForResponse(Timeout) ;WaitForResponse方法确保获取的是完整的响应 | ||
ADO:=ComObjCreate("adodb.stream") ;使用 adodb.stream 编码返回值。参考 http://bbs.howtoadmin.com/ThRead-814-1-1.html | ||
ADO.Type:=1 ;以二进制方式操作 | ||
ADO.Mode:=3 ;可同时进行读写 | ||
ADO.Open() ;开启物件 | ||
ADO.Write(WebRequest.ResponseBody()) ;写入物件。注意没法将 WebRequest.ResponseBody() 存入一个变量,所以必须用这种方式写文件 | ||
ADO.SaveToFile(FilePath,2) ;文件存在则覆盖 | ||
ADO.Close() | ||
return, 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
SetTitleMatchMode 2 | ||
Run,cmd | ||
WinWait, ahk_class ConsoleWindowClass, | ||
IfWinNotActive, ahk_class ConsoleWindowClass, , WinActivate, ahk_class ConsoleWindowClass, | ||
WinWaitActive, ahk_class ConsoleWindowClass, | ||
ControlSend, , lsnrctl stop {Enter}, cmd.exe | ||
ControlSend, , sqlplus /nolog {Enter}, cmd.exe | ||
ControlSend, , conn sys /as sysdba {Enter} {Enter}, cmd.exe | ||
ControlSend, , shutdow immediate; {Enter}, cmd.exe | ||
ControlSend, , startup; {Enter}, cmd.exe | ||
ControlSend, , exit; {Enter}, cmd.exe | ||
ControlSend, , lsnrctl start {Enter}, cmd.exe | ||
WinWaitClose, ahk_class ConsoleWindowClass, |
Oops, something went wrong.