是一个 多功能工具集,通过一个 GUI 图形界面集成了多种实用功能,包括截图、鼠标坐标显示、调暗屏幕、实时显示系统时间等。

 

Gdip调用系统截图的工具.ahk

Plain text
复制到剪贴板
Open code in new window
EnlighterJS 3 Syntax Highlighter
#IfWinActive, 工具集
#SingleInstance Force
#NoEnv
#Include <Gdip>
SetWorkingDir %A_ScriptDir%
SetBatchLines -1
Gui, 1: Font, s11
Gui, 1: Add, Tab3, x0 y0 w285 h200, 截图到桌面|显示坐标|调暗屏幕|显示时间
Gui, 1: Add, Button, x95 y70 w75 h23, 截图
Gui, 1: Add, Text, x50 y130 w280 h100, 截屏后文件自动保存到桌面`n重复截屏会覆盖之前的文件
Gui, 1: Tab, 2
Gui, 1: Add, Button, x40 y96 w75 h23, 开启
Gui, 1: Add, Button, x150 y96 w75 h23, 关闭
Gui, 1: Tab, 3
Gui, 1: Add, Button, x40 y96 w75 h23, start
Gui, 1: Add, Button, x150 y96 w75 h23, stop
Gui, 1: Show, x527 y491 w280 h200, 工具集
Gui, 1: Tab, 4
Gui, 1: Add, Button, x40 y96 w75 h23, 开始
Gui, 1: Add, Button, x150 y96 w75 h23, 停止
Return
Button截图:
Send {LShift}+{LWin down}+{S}+{LWin up}
Sleep,5000
Gdip_CaptureClipboard(A_Desktop "\截屏.jpg", 100)
;剪贴板图片保存
Gdip_CaptureClipboard(file, quality){
PToken := Gdip_Startup()
pBitmap := Gdip_CreateBitmapFromClipboard()
Gdip_SaveBitmaptoFile(pBitmap, file, quality)
Gdip_DisposeImage( pBitmap )
Gdip_Shutdown( PToken)
}
Return
Button开启:
CustomColor := "EEAA99" ; 可以为任意 RGB 颜色(在下面会被设置为透明)).
Gui, 2:New
Gui, 2: +LastFound +AlwaysOnTop -Caption +ToolWindow ; +ToolWindow 避免显示任务栏按钮和 alt-tab 菜单项.
Gui, 2:Color, %CustomColor%
Gui, 2:Font, s32 ; 设置大字体 (32 磅).
Gui, 2:Add, Text, vMyText cLime, XXXXX YYYYY ; XX & YY 用来自动调整窗口大小.
; 让此颜色的所有像素透明且让文本显示为半透明 (150):
WinSet, TransColor, %CustomColor% 150
;SetTimer, UpdateOSD, 200
SetTimer, Button开启, 200
Gosub, UpdateOSD ; 立即进行第一此更新而不等待计时器.
Gui, 2:Show, x0 y400 NoActivate ; NoActivate 让当前活动窗口继续保持活动状态.
return
UpdateOSD:
MouseGetPos, MouseX, MouseY
GuiControl,, MyText, X%MouseX%, Y%MouseY%
return
Button关闭:
SetTimer, Button开启, off
Gui, 2:Destroy
Return
Buttonstart:
Gui, 3:New
Gui, 3:Color, Black
Gui, 3:+AlwaysOnTop +LastFound
WinSet, Transparent, 120
Gui, 3:-Caption -Border +ToolWindow
W = %A_ScreenWidth%
H = %A_ScreenHeight%
Gui, 3:Show, x0 y0 h%H% w%W%
gui, 3:+LastFound +AlwaysOnTop
WinSet, ExStyle, +0x20
return
Buttonstop:
Gui, 3:Destroy
Return
Button开始:
CustomColor := "EEAA99" ; 可以为任意 RGB 颜色(在下面会被设置为透明)).
Gui, 4:New
Gui, 4: +LastFound +AlwaysOnTop -Caption +ToolWindow ; +ToolWindow 避免显示任务栏按钮和 alt-tab 菜单项.
Gui, 4:Color, %CustomColor%
Gui, 4:Font, s23 ; 设置大字体 (32 磅).
Gui, 4:Add, Text, vMyText1 cBlack, XXXXX YYYYY ; XX & YY 用来自动调整窗口大小.
; 让此颜色的所有像素透明且让文本显示为半透明 (150):
WinSet, TransColor, %CustomColor% 150
;SetTimer, UpdateOSD, 200
SetTimer, Button开始, 1000
Gosub, UpdateOSD1 ; 立即进行第一此更新而不等待计时器.
Gui, 4:Show, x1235 y-8 NoActivate ; NoActivate 让当前活动窗口继续保持活动状态.
return
UpdateOSD1:
GuiControl,, MyText1, %A_Hour%:%A_Min%:%A_Sec%
Return
Button停止:
SetTimer, Button开始, Off
Gui, 4:Destroy
Return
GuiEscape:
GuiClose:
ExitApp
#IfWinActive, 工具集 #SingleInstance Force #NoEnv #Include <Gdip> SetWorkingDir %A_ScriptDir% SetBatchLines -1 Gui, 1: Font, s11 Gui, 1: Add, Tab3, x0 y0 w285 h200, 截图到桌面|显示坐标|调暗屏幕|显示时间 Gui, 1: Add, Button, x95 y70 w75 h23, 截图 Gui, 1: Add, Text, x50 y130 w280 h100, 截屏后文件自动保存到桌面`n重复截屏会覆盖之前的文件 Gui, 1: Tab, 2 Gui, 1: Add, Button, x40 y96 w75 h23, 开启 Gui, 1: Add, Button, x150 y96 w75 h23, 关闭 Gui, 1: Tab, 3 Gui, 1: Add, Button, x40 y96 w75 h23, start Gui, 1: Add, Button, x150 y96 w75 h23, stop Gui, 1: Show, x527 y491 w280 h200, 工具集 Gui, 1: Tab, 4 Gui, 1: Add, Button, x40 y96 w75 h23, 开始 Gui, 1: Add, Button, x150 y96 w75 h23, 停止 Return Button截图: Send {LShift}+{LWin down}+{S}+{LWin up} Sleep,5000 Gdip_CaptureClipboard(A_Desktop "\截屏.jpg", 100) ;剪贴板图片保存 Gdip_CaptureClipboard(file, quality){ PToken := Gdip_Startup() pBitmap := Gdip_CreateBitmapFromClipboard() Gdip_SaveBitmaptoFile(pBitmap, file, quality) Gdip_DisposeImage( pBitmap ) Gdip_Shutdown( PToken) } Return Button开启: CustomColor := "EEAA99" ; 可以为任意 RGB 颜色(在下面会被设置为透明)). Gui, 2:New Gui, 2: +LastFound +AlwaysOnTop -Caption +ToolWindow ; +ToolWindow 避免显示任务栏按钮和 alt-tab 菜单项. Gui, 2:Color, %CustomColor% Gui, 2:Font, s32 ; 设置大字体 (32 磅). Gui, 2:Add, Text, vMyText cLime, XXXXX YYYYY ; XX & YY 用来自动调整窗口大小. ; 让此颜色的所有像素透明且让文本显示为半透明 (150): WinSet, TransColor, %CustomColor% 150 ;SetTimer, UpdateOSD, 200 SetTimer, Button开启, 200 Gosub, UpdateOSD ; 立即进行第一此更新而不等待计时器. Gui, 2:Show, x0 y400 NoActivate ; NoActivate 让当前活动窗口继续保持活动状态. return UpdateOSD: MouseGetPos, MouseX, MouseY GuiControl,, MyText, X%MouseX%, Y%MouseY% return Button关闭: SetTimer, Button开启, off Gui, 2:Destroy Return Buttonstart: Gui, 3:New Gui, 3:Color, Black Gui, 3:+AlwaysOnTop +LastFound WinSet, Transparent, 120 Gui, 3:-Caption -Border +ToolWindow W = %A_ScreenWidth% H = %A_ScreenHeight% Gui, 3:Show, x0 y0 h%H% w%W% gui, 3:+LastFound +AlwaysOnTop WinSet, ExStyle, +0x20 return Buttonstop: Gui, 3:Destroy Return Button开始: CustomColor := "EEAA99" ; 可以为任意 RGB 颜色(在下面会被设置为透明)). Gui, 4:New Gui, 4: +LastFound +AlwaysOnTop -Caption +ToolWindow ; +ToolWindow 避免显示任务栏按钮和 alt-tab 菜单项. Gui, 4:Color, %CustomColor% Gui, 4:Font, s23 ; 设置大字体 (32 磅). Gui, 4:Add, Text, vMyText1 cBlack, XXXXX YYYYY ; XX & YY 用来自动调整窗口大小. ; 让此颜色的所有像素透明且让文本显示为半透明 (150): WinSet, TransColor, %CustomColor% 150 ;SetTimer, UpdateOSD, 200 SetTimer, Button开始, 1000 Gosub, UpdateOSD1 ; 立即进行第一此更新而不等待计时器. Gui, 4:Show, x1235 y-8 NoActivate ; NoActivate 让当前活动窗口继续保持活动状态. return UpdateOSD1: GuiControl,, MyText1, %A_Hour%:%A_Min%:%A_Sec% Return Button停止: SetTimer, Button开始, Off Gui, 4:Destroy Return GuiEscape: GuiClose: ExitApp
#IfWinActive, 工具集
#SingleInstance Force
#NoEnv
#Include <Gdip>
SetWorkingDir %A_ScriptDir%
SetBatchLines -1

Gui, 1: Font, s11
Gui, 1: Add, Tab3, x0  y0  w285 h200, 截图到桌面|显示坐标|调暗屏幕|显示时间
Gui, 1: Add, Button, x95 y70 w75 h23, 截图
Gui, 1: Add, Text, x50 y130 w280 h100, 截屏后文件自动保存到桌面`n重复截屏会覆盖之前的文件
Gui, 1: Tab, 2 
Gui, 1: Add, Button, x40 y96 w75 h23, 开启
Gui, 1: Add, Button, x150 y96 w75 h23, 关闭
Gui, 1: Tab, 3
Gui, 1: Add, Button, x40 y96 w75 h23, start
Gui, 1: Add, Button, x150 y96 w75 h23, stop
Gui, 1: Show, x527 y491 w280 h200, 工具集
Gui, 1: Tab, 4
Gui, 1: Add, Button, x40 y96 w75 h23, 开始
Gui, 1: Add, Button, x150 y96 w75 h23, 停止
Return

Button截图:
Send {LShift}+{LWin down}+{S}+{LWin up}
Sleep,5000
Gdip_CaptureClipboard(A_Desktop "\截屏.jpg", 100)

;剪贴板图片保存
Gdip_CaptureClipboard(file, quality){
  PToken := Gdip_Startup()
  pBitmap := Gdip_CreateBitmapFromClipboard()
  Gdip_SaveBitmaptoFile(pBitmap, file, quality)
  Gdip_DisposeImage( pBitmap )
  Gdip_Shutdown( PToken)
}
Return
 
Button开启:
CustomColor := "EEAA99"  ; 可以为任意 RGB 颜色(在下面会被设置为透明)).
Gui, 2:New
Gui, 2: +LastFound +AlwaysOnTop -Caption +ToolWindow  ; +ToolWindow 避免显示任务栏按钮和 alt-tab 菜单项.
Gui, 2:Color, %CustomColor%
Gui, 2:Font, s32  ; 设置大字体 (32 磅).
Gui, 2:Add, Text, vMyText cLime, XXXXX YYYYY  ; XX & YY 用来自动调整窗口大小.
; 让此颜色的所有像素透明且让文本显示为半透明 (150):
WinSet, TransColor, %CustomColor% 150
;SetTimer, UpdateOSD, 200
SetTimer, Button开启, 200
Gosub, UpdateOSD  ; 立即进行第一此更新而不等待计时器.
Gui, 2:Show, x0 y400 NoActivate  ; NoActivate 让当前活动窗口继续保持活动状态.
return

UpdateOSD:
MouseGetPos, MouseX, MouseY
GuiControl,, MyText, X%MouseX%, Y%MouseY%
return

Button关闭:
SetTimer, Button开启, off
Gui, 2:Destroy
Return

Buttonstart:
Gui, 3:New
Gui, 3:Color, Black
Gui, 3:+AlwaysOnTop +LastFound
WinSet, Transparent, 120
Gui, 3:-Caption -Border +ToolWindow
W = %A_ScreenWidth%
H = %A_ScreenHeight%
Gui, 3:Show, x0 y0 h%H% w%W%
gui, 3:+LastFound +AlwaysOnTop
WinSet, ExStyle, +0x20
return

Buttonstop:
Gui, 3:Destroy
Return

Button开始:
CustomColor := "EEAA99"  ; 可以为任意 RGB 颜色(在下面会被设置为透明)).  
Gui, 4:New
Gui, 4: +LastFound +AlwaysOnTop -Caption +ToolWindow  ; +ToolWindow 避免显示任务栏按钮和 alt-tab 菜单项.  
Gui, 4:Color, %CustomColor%  
Gui, 4:Font, s23 ; 设置大字体 (32 磅).  
Gui, 4:Add, Text, vMyText1 cBlack, XXXXX YYYYY  ; XX & YY 用来自动调整窗口大小.  
; 让此颜色的所有像素透明且让文本显示为半透明 (150):  
WinSet, TransColor, %CustomColor% 150  
;SetTimer, UpdateOSD, 200
SetTimer, Button开始, 1000
Gosub, UpdateOSD1  ; 立即进行第一此更新而不等待计时器.  
Gui, 4:Show, x1235 y-8 NoActivate  ; NoActivate 让当前活动窗口继续保持活动状态.  
return  
  
UpdateOSD1:  
GuiControl,, MyText1, %A_Hour%:%A_Min%:%A_Sec%  
Return  

Button停止:
SetTimer, Button开始, Off
Gui, 4:Destroy
Return

GuiEscape:
GuiClose:
    ExitApp

 

声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。