Timer functions

Hello once again,

I made a script, that switches my rackspace variations and/or the pages of an opened pdf file according to an array of integer values. Each value represents the next action my footswitch shall trigger:
1 - next rackspace variation
2 - next pdf page
3 - turn both
So far it works quite well.

Now I would like to be able to go backwards in this script, if I trigger the footswitch twice in a short period of time.
The first time I press on the switch, a timer should start, and after a certain amount of time, a callback function should clear the timer and switch the program forward. Or, if I press the switch a second time, before the timer ends, it should clear the timer and switch backwards.

Is this possible with the On TimePassed() function? I was not able to make it work. But I have no idea, how to use this function at all. The documentation is rather sparse here.
Another solution, that came to my mind was the SendLater() function. I would send a note message on an unused MidiInBlock, and then use the On NoteOnEvent() function.
But the latter does not seem to be called by notes send via SendLater().

Any ideas?

Thanks in advance,
Markus

Take a look at this

Three button footswitch

I uploaded a gig with a script which could be useful for you.

Yes, thanks for the advice. I already thought about a hardware solution myself.
I found this very inexpensive device:

https://www.amazon.de/dp/B00WS2GZU2/?coliid=IRA1WRWZSXTRR&colid=3P46T55QN0AW6&psc=1&ref_=lv_ov_lig_dp_it

It seems to simulate the pressing of a key on the computer keyboard. But I guess with the help of the MidiKey2Key tool, we talked about in another context, it should be possible to make this work with GP.

But nonetheless, I would really like to know, how these timer functions in gp script work.

Take a look at this

Create a volume ramp up and fade out

A bit late for me I’m afraid.
Some drilling and soldering later, I have a three button footswitch that has three discrete switch outputs.