"GoTo a Label" from a Function Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Guill
Posts: 141
Joined: 09 Jun 2016, 22:00

"GoTo a Label" from a Function

24 Jul 2020, 17:18

Hello guys,
I would like to know if you can help me with the following problem:

I have the following code so that, eventually, after pressing + f1, I temporarily change the function of Numpad0, but not to forget that this function is activated, I would like a Traytip to remind me of this every 7 seconds.
The problem is that I cannot do it from a Loop, because that is what the Error Message tells me.

Do you know any alternative I could use?

Code: Select all


+F1::
MyFunc0pad() 
MyFunc0pad() { 
static boolean := false

if (boolean:=!boolean) {
Hotkey, Numpad0, ZeroSpecialFunc
Goto TrayZero:  ; << ==    PROBLEM
Return
}

else {
Traytip, ZERO, DEFAULT
Hotkey, Numpad0, Numpad0Default
Reload

	}
}
Return


ZeroSpecialFunc:
{
Send {Rbutton}
sleep 322
Send {Down 2} {Enter}
sleep 722
Send {Tab 3}{Enter}
sleep 822
}
Return


Numpad0Default: 
Send {Numpad0}
Return


TrayZero:
Loop
{
Traytip, ZERO special func, "ON"
Sleep 1500
Traytip
sleep 7000

}
Return
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: "GoTo a Label" from a Function  Topic is solved

24 Jul 2020, 19:36

Not only can you not goto a label from inside a function to outside, you wouldn’t want to go to that label because it’s an infinite loop and it would never return. Try using SetTimer to launch a subroutine to display your TrayTip every seven seconds by setting the period to 7000.
Guill
Posts: 141
Joined: 09 Jun 2016, 22:00

Re: "GoTo a Label" from a Function

24 Jul 2020, 20:01

boiler wrote:
24 Jul 2020, 19:36
Not only can you not goto a label from inside a function to outside, you wouldn’t want to go to that label because it’s an infinite loop and it would never return. Try using SetTimer to launch a subroutine to display your TrayTip every seven seconds by setting the period to 7000.
Thank you very much Boiler

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo, mikeyww, vanove and 160 guests