Autohotkey个人即用脚本分享(持续更新ing)

本楼为通用脚本

1. 快速选取并调用OnTopReplica置顶窗口局部

点击按钮后,左键画个区域,即可将该窗口这一区域置顶显示

1

代码
#Requires AutoHotkey v2
;自行修改第八行OnTopReplica路径,以及透明度等参数

; Select Screen Region with Mouse
LButton:: ;Mouse to select with Red
{
	Area := SelectScreenRegion("LButton", "Red", 30)
	WinGetPos &winX, &winY, &WinW, &winH, "ahk_id " Area.id
  Run '"C:\Program Files (x86)\OnTopReplica\OnTopReplica\OnTopReplica.exe" --windowId=' Area.id ' --size=' Area.W ',' Area.H ' --position=' Area.X ',' Area.Y ' --opacity=200 --chromeOff --region=' Area.X-winX ',' Area.Y-winY ',' Area.W ',' Area.H 
  exitapp
}


SelectScreenRegion(Key, Color := "Lime", Transparent:= 80)
{
	CoordMode("Mouse", "Screen")
	MouseGetPos(&sX, &sY, &winid)
	ssrGui := Gui("+AlwaysOnTop -caption +Border +ToolWindow +LastFound -DPIScale")
	WinSetTransparent(Transparent)
	ssrGui.BackColor := Color
	Loop 
	{
		Sleep 10
		MouseGetPos(&eX, &eY)
		W := Abs(sX - eX), H := Abs(sY - eY)
		X := Min(sX, eX), Y := Min(sY, eY)
		ssrGui.Show("x" X " y" Y " w" W " h" H)
	} Until !GetKeyState(Key, "p")
	ssrGui.Destroy()
	Return { X: X, Y: Y, W: W, H: H, X2: X + W, Y2: Y + H ,id: winid}
}

/*OnTopReplica支持的所有参数
      --windowId=HWND        Window handle (HWND) to be cloned.
      --windowTitle=TITLE    Partial TITLE of the window to be cloned.
      --windowClass=CLASS    CLASS of the window to be cloned.
  -v, --visible              If set, only clones windows that are visible.
      --size=WIDTH,HEIGHT    Target WIDTH,HEIGHT of the cloned thumbnail, or
      --width=VALUE          Target WIDTH of cloned thumbnail, or
      --height=VALUE         Target HEIGHT of cloned thumbnail.
      --position=X,Y         Target X,Y of the OnTopReplica window.
      --screenPosition=TR|TL|C|BR|BL
                             Resolution independent window position on 
                               current screen, with locking. Values: 
                               TR|TL|C|BR|BL.
  -r, --region=X,Y,W,H       Region X,Y,W,H of the cloned window.
  -p, --padding=LEFT,TOP,RIGHT,BOTTOM
                             Region padding LEFT,TOP,RIGHT,BOTTOM of the 
                               clone.
  -o, --opacity=0-255        Opacity of the window: 0-255.
      --clickForwarding      Enables click forwarding.
      --clickThrough         Enables click through.
      --chromeOff            Disables the window's chrome (border).
      --fs, --fullscreen     Starts up in fullscreen mode.
  -h, --help, -?             Show command line help.
	*/
4 个赞