chaohershi / cclose

A Windows utility that helps you close windows faster or pin windows always on top.

Home Page:https://chaohershi.github.io/cclose/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add autopin rule?

yingxiaoGuo opened this issue · comments

is it possible to add autopin rule for specific window? Like every time it opens, it will be pined

It's achievable, but I probably won't add it. It feels a bit unnecessary to add this as a feature.

Here is the code:

Loop
{
	WinGet, PinList, List, ahk_class Notepad ; change here (use Window Spy for help)
	Loop, %PinList%
	{
		WinGet, ExStyle, ExStyle, % "ahk_id " PinList%A_Index% ; get ExStyle
		if !(ExStyle & 0x8) ; if not AlwaysOnTop (0x8 is WS_EX_TOPMOST)
		{
			Winset, Alwaysontop, On, % "ahk_id " PinList%A_Index%
		}
	}
}

To run it, you will need to have AutoHotkey installed. Then save the code as AutoPin.ahk.