Using menu gui as a counter

Get help with using AutoHotkey and its commands and hotkeys
dice4321
Posts: 8
Joined: 21 May 2016, 21:44
Google: Fatal_Pulse

Using menu gui as a counter

29 May 2018, 19:25

I'm trying to use the menu GUI as a counter, I want it to count up to 6 and reset back to zero, but everytime it counts up to 6 and restarts to 0 it crashes

Code: Select all

	RetirementCounter := Mod(Sortiecount, 6) 
	ti := RetirementCounter+1
	Menu, Main, Rename, %RetirementCounter%, %ti%
	RetirementCounter += 1
	SortieCount++
Image

Is there a way to achieve getting a counter into the menu gui?
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Using menu gui as a counter

29 May 2018, 20:11

use Try like this:

Code: Select all

	RetirementCounter := Mod(Sortiecount, 6) 
	ti := RetirementCounter+1
	Try, Menu, Main, Rename, %RetirementCounter%, %ti%
	RetirementCounter += 1
	SortieCount++
I hope that helps.
dice4321
Posts: 8
Joined: 21 May 2016, 21:44
Google: Fatal_Pulse

Re: Using menu gui as a counter

30 May 2018, 01:28

Thanks wolf, it stopped crashing but now its just stuck at 6, getting closer to the solution!
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Using menu gui as a counter

30 May 2018, 02:57

Try this:

Code: Select all

old := Count := 1
Menu, MainMenu, Add, %Count%, Label
Gui, Menu, MainMenu
Gui, Add, Button, w250 h100, Next
Gui, Show

Label:
Return

ButtonNext:
new := Mod(Count++, 6) + 1
Menu, MainMenu, Rename, %old%, %new%
old := new
Return
I hope that helps.

Return to “Ask For Help”

Who is online

Users browsing this forum: AHK_user, flyingDman, Lisa19 and 48 guests