[AHK]一键运行/关闭脚本的循环


;Toggle: Press once to activate, press again to turn it off



#maxThreadsPerHotkey, 2
setKeyDelay, 50, 50
setMouseDelay, 50
banana:=0

$f1::
	; banana:=!banana .... This assigns banana to the value of NOT (!) banana. so lets
	; say banana starts out FALSE (0). you then turn banana to NOT FALSE. which is
	; TRUE (1). so now banana is set to TRUE. and then lets say you toggle it again.
	; you set banana to NOT TRUE, which is FALSE. banana is now set to FALSE. 
	; .... 1 is true, 0 is false. ! is NOT.
	banana:=!banana
	
	while (banana=1)
	{
		send, hello{space}
		sleep, 100
	}
return


你可能感兴趣的:(AutoHotkey,AHK,热键,激活,打开,重复)