Conditions on NowTime? - BTTLastTriggerTime < 5 seconds

I have a gesture on my Trackpad that shall snap my window to a certain position if the BTTLastTriggeredUUID is something and do something else if this is not the case. This works fine.

But actually, I would like this condition to be

BTTLastTriggeredUUID == "7AAB391C-FD6E-4441-9929-10A2F174147C" AND 
**CurrentTime** - BTTLastTriggerTime  < 5

Can somebody help me with how I can get the current time?
Thank you very much

This currently can not be achieved with the advanced trigger conditions.

However you could use the "run real java script" action like this:

(async ()=> {

let lastTriggerUUID = await callBTT('get_string_variable',  {variable_name:'BTTLastTriggeredUUID'});
let lastTriggerTime = await callBTT('get_number_variable',  {variable_name:'BTTLastTriggerTime'});
let secondsSinceJan2001 = ((new Date()) - (new Date('January 1, 2001')).getTime())/1000 - 3600;
let secondsSinceLastTrigger = secondsSinceJan2001 - lastTriggerTime;

if(lastTriggerUUID == "7AAB391C-FD6E-4441-9929-10A2F174147C" &&lastsecondsSinceLastTrigger < 5) {
   await callBTT('trigger_named', {trigger_name: 'TheNameOfYourNamedTrigger'});
}


returnToBTT('seconds since last trigger: ' +  secondsSinceLastTrigger);
})();



This would trigger a named trigger (configured in the "Automations, Named & Other Triggers" section in BTT). Unfortunately BTTLastTriggerTime is currently using the seconds since 00:00:00 1 January 2001 (Apple default), so some calculations are necessary (see code snippet).

I'll add a better variable "BTTSecondsSinceLastTrigger" to the advanced trigger conditions soon to make this much easier.

Thank you that the variable seconds_since_last_trigger exists. But currently both the > and < operator evaluate on false on it. I assume there is a bug that the variable is considered to be a string instead of a float:

This is the output I get:

BTTLastTriggeredUUID != "C3FC3C06-D313-4016-A971-15D41D981E64" AND BTTLastTriggeredUUID != "7AAB391C-FD6E-4441-9929-10A2F174147C" AND seconds_since_last_trigger <= "3" .

1 Like

you are right, it has accidentally been defined as string. Will be fixed with next update.

Thanks, Andreas,
What do you think, roughly when will you publish the next update?

alpha tomorrow, stable next week