AutoHotkey v2 での #IfWinNotActive (#Hotif)

日記

AutoHotkey バージョン2では、#IfWinActive#IfWinExist#IfWinNotActive#IfWinNotExist が削除され、代わりに #Hotif になった。

#HotIf - 構文と使用法|AutoHotkey v2
#HotIfディレクティブは、コンテキストに応じたホットキーとホットストリングを作成します。They perform a different action (or none at all) depending on any conditio...

例えば AutoHotkey バージョン1の #IfWinActive は、バージョン2では以下のように書く。

#HotIf WinActive("ahk_class TeamsWebView")
	!a::
	{
		MsgBox "Teamsです"
	}
#HotIf

逆に #IfWinNotActive は以下のように書く。

#HotIf !WinActive("ahk_class TeamsWebView")
	!a::
	{
		MsgBox "Teamsではありません"
	}
#HotIf

もしくは以下のようにも書ける。

#HotIf Not WinActive("ahk_class TeamsWebView")
	!a::
	{
		MsgBox "Teamsではありません"
	}
#HotIf

コメント

タイトルとURLをコピーしました