Secondary routine out of a current routine for SendMessage

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
blad4
Posts: 315
Joined: 07 Oct 2015, 11:06

Secondary routine out of a current routine for SendMessage

18 Mar 2018, 10:38

I can successfully cycle between the following

Code: Select all

StepDelay := -9999999999                                     
global MessageList := [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11], [12, 13], [14, 15], [16, 17], [18, 19]]
Using what has been created for me using previous help here:

Code: Select all

Sequence:
    ; CustomMessage uses SendMessage. Different values are used depending on Index - see the
    ; function definition at the end.
    CustomMessage(Index)
    TimerSet := A_TickCount  ; Record when the timer was started. This is used for the countdown
    SetTimer, Sequence, % TimerLength := StepDelay             ; Set the timer for the next time
Return

CustomMessage(ByRef Index)
{
    if (++Index > 10)                                    ; Add one to Index. If Index is > 61...
        Index := 1                                                                ; Reset to one
 
    SendMessage, 0x1330, MessageList[Index, 1], 1, SysTabControl321, Sierra ;TCM_SETCURFOCUS = 0x1330
    SendMessage, 0x1330, MessageList[Index, 2], 1, SysTabControl321, Sierra ;TCM_SETCURFOCUS = 0x1330
}
Now I would love to trigger a secondary sequence, in which I can go from something custom. Such as Index1-Index4. The condition of this however would be to go 1,2,3,4, back to 1, then up to 4 again. As opposed to the original Sequence above which can only go forwards (1,2,3,4,etc)

So far, I have got help in creating this, but it just sends the Messagelist Index as numbers and commas, i.e. 0,1 then 2,3 etc

Code: Select all

	TestLabel:
	
	StartIndex := 1
	EndIndex := 4
	InterruptMe := 0
	SlX := 2000	; Sleep duration.

	Loop,	;  Send MessageList endlessly until interrupted.
	{
		LoopIndex := StartIndex - 1
		
		Loop, % EndIndex - StartIndex + 1	; Loop as many times as there are entries between End and Start.
		{
			LoopIndex ++
			
			SEND, % MessageList[LoopIndex, 1] "," MessageList[LoopIndex, 2]
			SLEEP SlX
			
			If InterruptMe
			{
				ErrorLevel := 1
				Return
			}
		}
		Loop, % EndIndex - StartIndex - 1
		{
			LoopIndex --
			
			SEND, % MessageList[LoopIndex, 1] "," MessageList[LoopIndex, 2]
			SLEEP SlX
			
			If InterruptMe
			{
				ErrorLevel := 1
				Return
			}
		}
	}
Return
}
I also want to be break this custom secondary loop at any time, using IntteruptMe := 0/1

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, vikasgandhi and 329 guests