Autohotkey 自动热键监视IP脚本并关闭应用程序
使用检查IP的脚本,然后在IP不相等时关闭notepad2.exe。问题是脚本无论如何都会关闭notepad2.exeAutohotkey 自动热键监视IP脚本并关闭应用程序,autohotkey,Autohotkey,使用检查IP的脚本,然后在IP不相等时关闭notepad2.exe。问题是脚本无论如何都会关闭notepad2.exe #SingleInstance #Persistent Settimer, CheckIP, 500 vIPaddress = "192.168.1.14" CheckIP: vCurrentaddr = %A_IPAddress1% if (vIPaddress <> vCurrentaddr) { Process,
#SingleInstance
#Persistent
Settimer, CheckIP, 500
vIPaddress = "192.168.1.14"
CheckIP:
vCurrentaddr = %A_IPAddress1%
if (vIPaddress <> vCurrentaddr)
{
Process, Close, Notepad2.exe
}
return
f10::exitapp ; when I need to stop watchdog
#单实例
#持久的
设置计时器,检查IP,500
vIPaddress=“192.168.1.14”
检查IP:
vCurrentAddress=%A\u IPAddress1%
if(vIPaddress vCurrentAddress)
{
进程,关闭,Notepad2.exe
}
回来
f10::exitapp;当我需要阻止看门狗的时候
编辑:
更正了脚本,因此现在它不会一直关闭notepad2.exe,但现在问题是它不会更新vCurrentAddress=%A_IPAddress1%的值。现在,它不会使用以下命令关闭notepad2.exe:
if(vIPaddress vCurrentaddr)\SingleInstance
#持久的
设置计时器,检查IP,500
vIPaddress=192.168.1.4
检查IP:
vCurrentAddress=%A\u IPAddress1%
vCurrentAddress2=%A\u IPAddress2%
if(vIPaddress vCurrentAddress)
{
进程,关闭,Notepad2.exe
}
else if(vCurrentAddress2“0.0.0.0”)
{
if(vIPaddress vCurrentAddress2)
{
进程,关闭,Notepad2.exe
}
}
回来
f10::exitapp;当我需要阻止看门狗的时候
这似乎是因为vCurrentaddr2保存更改的IP。未连接到VPN时,该值为0.0.0,连接到VPN后,该值会发生变化
编辑:
清理非索引语句的代码
#SingleInstance
#Persistent
Settimer, CheckIP, 500
vIPaddress = 192.168.1.4
CheckIP:
vCurrentaddr = %A_IPAddress1%
vCurrentaddr2 = %A_IPAddress2%
if (vIPaddress <> vCurrentaddr)
{
Process, Close, Notepad2.exe
}
else if (vCurrentaddr2 <> "0.0.0.0")
{
if (vIPaddress <> vCurrentaddr2)
{
Process, Close, Notepad2.exe
}
}
return
f10::exitapp ; when I need to stop watchdog