2024/4/09/01:33
更新了脚本, 取消snipaste贴图 因为snipaste切换贴图组不是很方便 ,改用ahk的gui, 启动时, 显示无边框图片控件, 设有2张图片, 鼠标覆盖图片1(小图)时, 显示图片2(大图) . 并且会搜索大图中的各小图坐标, 根据坐标及其偏移量, 点击时执行相应动作. 相当于是一个
「ahk悬浮图片启动器」
2024/4/09/23:06
配合onenote还挺丝滑
;Menu, Tray, Icon,
CoordMode, Mouse, Screen
SetTimer, Mouse_Move, 100
fixed := 0
doubanX := "", doubanY := ""
searchX := "" searchY := ""
ouluX := "" ouluY := ""
suanshuX := "" suanshuY := ""
runthisX := "" runthisY := ""
varnameX := "" varnameY := ""
ahkhelpX := "" ahkhelpY := ""
spyX := "" spyY := ""
winX := ""
Gui, +OwnDialogs +AlwaysOnTop -Caption
Gui, Margin, 0, 0
Gui, Add, Picture, x0 y0 w25 h25 hwndMyPicture1, D:\图片\PixPin_2024-04-01_20-26-19.png ; 创建第一个图片控件
Gui, Add, Picture, x0 y0 hwndMyPicture2, D:\Documents\ahk\imagesearch\2024-04-08_22-42-23.png ; 创建第二个图片控件
Gui, Show, AutoSize, MyWindow
WinSet, Transparent, 100, MyWindow
OnMessage(0x201, "move_Win")
return
Mouse_Move:
MouseGetPos, x_pos, y_pos
WinGetPos, X, Y, Width, Height, MyWindow
if(X != winX){ ; 检查窗口是否移动了
winX := X
goto winmoved ; 如果窗口x坐标与之前不同, 则跳到winmoved
}
if (x_pos > X && x_pos < X+Width && y_pos > Y && y_pos < Y+Height){
WinHide, ahk_id %MyPicture1% ; 隐藏第一个图片控件
WinShow, ahk_id %MyPicture2% ; 显示第二个图片控件
WinMove, MyWindow,,,,110,120
WinSet, Transparent, 255, MyWindow
}
else {
if(fixed = 1){
return
}else {
WinHide, ahk_id %MyPicture2% ; 隐藏第二个图片控件
WinShow, ahk_id %MyPicture1% ; 显示第一个图片控件
WinMove, MyWindow,,,,25,25
WinSet, Transparent, 55, MyWindow
}
}
~MButton Up:: ; 鼠标中键点击,
WinGetPos, X, Y, Width, Height, MyWindow
if(width > 50){
CoordMode, Mouse, Screen
MouseGetPos, x, y
if (x > suanshuX && x < suanshuX+34 && y > suanshuY && y < suanshuY+31) { ; 检查点击位置在小图片坐标区域
Run, 754计算统计.txt
}
}
return
~LButton Up::
WinGetPos, X, Y, Width, Height, MyWindow
if(width > 50){
CoordMode, Mouse, Screen
MouseGetPos, x, y
if (x > doubanX && x < doubanX+13 && y > doubanY && y < doubanY+16) {
Run, 随机豆瓣图书.ahk
MsgBox,,,随机豆瓣图书, 0.3
}
if (x > searchX && x < searchX+22 && y > searchY && y < searchY+20) {
MsgBox,,,搜索, 0.5
}
if (x > ouluX && x < ouluX+12 && y > ouluY && y < ouluY+11) {
Send, ^{F12}
}
if (x > suanshuX && x < suanshuX+34 && y > suanshuY && y < suanshuY+31) {
Run, 754.ahk
}
if (x > runthisX && x < runthisX+105 && y > runthisY && y < runthisY+21) {
WinActivate, ahk_exe SciTE.exe
Sleep 500
WinGetTitle, title, ahk_exe SciTE.exe
index := InStr(title, "ahk")
if (index > 0){
result := SubStr(title, 1, index + 3)
}
Run, %result%
}
if (x > varnameX && x < varnameX+77 && y > varnameY && y < varnameY+34 ) {
Run, varname.ahk
}
if (x > ahkhelpX && x < ahkhelpX+77 && y > ahkhelpY && y < ahkhelpY+23 ) {
Run, AutoHotkey v2.chm
}
if (x > spyX && x < spyX+25 && y > spyY && y < spyY+24) {
Run, C:\Program Files\AutoHotkey\UX\WindowSpy.ahk
}
;fixed := 0
}
return
~^LButton up:: ; Ctrl+鼠标左键点击图片右下角10*10像素区域, 固定图片窗口
{
MouseGetPos, x_pos, y_pos
WinGetPos, X, Y, Width, Height, MyWindow
if(x_pos > X+ Width-10 && x_pos < X+ Width && y_pos > Y+ Height-10 && y_pos < Y+Height){
fixed += 1
if(fixed = 2){
fixed :=0
}
}
}
return
winmoved: ; 搜索图片, 重新给小图片坐标赋值
CoordMode, pixel, Screen
ImageSearch, doubanX, doubanY, 0, 0, 1599, 899, imagesearch\豆瓣.png
doubanX := doubanX, doubanY := doubanY
ImageSearch, searchX, searchY, 0, 0, 1599, 899, imagesearch\搜索.png
searchX := searchX, searchY := searchY
ImageSearch, ouluX, ouluY, 0, 0, 1599, 899, imagesearch\欧路词典.png
ouluX := ouluX, ouluY := ouluY
ImageSearch, suanshuX, suanshuY, 0, 0, 1599, 899, imagesearch\754.png
suanshuX := suanshuX, suanshuY := suanshuY
ImageSearch, runthisX, runthisY, 0, 0, 1599, 899, imagesearch\运行当前脚本.png
runthisX := runthisX, runthisY := runthisY
ImageSearch, varnameX, varnameY, 0, 0, 1599, 899, imagesearch\varname.png
varnameX := varnameX, varnameY := varnameY
ImageSearch, ahkhelpX, ahkhelpY, 0, 0, 1599, 899, imagesearch\帮助v2.png
ahkhelpX := ahkhelpX, ahkhelpY := ahkhelpY
ImageSearch, spyX, spyY, 0, 0, A_ScreenWidth, A_ScreenHeight, imagesearch\Windowsspy.png
spyX := spyX, spyY := spyY
fixed :=0
return
MyWindowExit:
GuiClose:
ExitApp
move_Win()
{
PostMessage, 0xA1, 2
}