How to announce a loop is ON or OFF with TrayTip Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
PristineComet
Posts: 1
Joined: 02 Dec 2022, 20:02

How to announce a loop is ON or OFF with TrayTip

Post by PristineComet » 02 Dec 2022, 20:10

Hello!

I have this code, and I wanted to make so there's a TrayTip, once, for when I toggle the loop ON, and once for when it's toggled OFF. I couldn't find anything online, so I'm asking for help here.

Code: Select all

#MaxThreadsPerHotkey 2
^!p::	
toggle := !toggle
loop
{
	if (toggle){
		mousemove, 10, 0, 20, R
		mousemove, -10, 0, 20, R
		sleep 3000
	}else{
		break
		}
}
return



User avatar
mikeyww
Posts: 26599
Joined: 09 Sep 2014, 18:38

Re: How to announce a loop is ON or OFF with TrayTip  Topic is solved

Post by mikeyww » 02 Dec 2022, 21:32

Welcome to this AutoHotkey forum!

You looked "online", but all of the AHK commands are documented. :arrow: TrayTip

Code: Select all

#MaxThreadsPerHotkey 2
^!p::
If on := !on {
 TrayTip, Loop on, Loop is on.,, 2
 SetTimer, TipOff, -3000
 While on {
  MouseMove,  10, 0, 20, R
  MouseMove, -10, 0, 20, R
  Sleep, 3000
 }
} Else {
 TrayTip, Loop off, Loop is off.,, 1
 SetTimer, TipOff, -3000
}
Return

TipOff:
TrayTip
If SubStr(A_OSVersion, 1, 3) = "10." {
 Menu, Tray, NoIcon
 Sleep, 200
 Menu, Tray, Icon
}
Return

Post Reply

Return to “Ask for Help (v1)”