BTTLastTriggerTime units?

Does anyone know what units BTTLastTriggerTime is measured in? And how to generate a timestamp in AppleScript to compare with BTTLastTriggerTime? @Andreas_Hegenberg

Hi @Andreas_Hegenberg just wanted to follow up briefly.

BTTLastTriggerTime just came out to be 610462040.09. It seems like you're using the # of seconds since year 2001? If you can confirm this / elaborate on why you're doing this rather than using seconds since 1970, that'll be helpful, thanks!

this of the default for macOS timestamps . You can get it via CFAbsoluteTimeGetCurrent(), this should also be callable from Apple Script

set theStart to current application's CFAbsoluteTimeGetCurrent()

1 Like

Thank you for the quick reply, Andreas! I love BetterTouchTool and appreciate all you do.

If anyone needs more help, here's a working example of how to get the time difference since last BTT trigger. Make sure to include use framework "Foundation"

use framework "Foundation"

set lastTrigger to get_number_variable "BTTLastTriggerTime"

set difference to (current application's CFAbsoluteTimeGetCurrent()) - lastTrigger
1 Like

What are you using this for? (I forgot why I added this variable :grinning: )

I have 4 touch bar groups (Battery Strip, Action Bar, System Stats, and Weather) that I show above my Menu Bar at different times.

I wanted to view them in one of two ways:

  1. Quick Glance: Hold modifier key and, when i release, close group / return to Menu Bar.

  2. Detailed View: Tap modifier key to open group. Tap again to close. (2 Taps)

I needed to differentiate between a key tap vs. a key hold (> 300ms). I initially wanted to compare the “Modifier Key-Up” timestamp with BTTLastTriggerTime (which i assumed to be the “Modifier Key Down” Timestamp.

But then I realized that another BTT trigger (not sure what) was occurring between the my key-up and key-down strokes — throwing off the time difference.

I ended up using a custom variable lastRecordedTriggerTime and setting the variable on Key-Down and getting the timestamp difference on Key-Up. - This works perfectly!

Your explanation of CFAbsoluteTimeGetCurrent was so helpful. Thank you for that.

A few follow up questions if you don't mind

  1. When should we use run AppleScript in background? Blocking has higher priority / is faster right?

  2. Are there performance benefits writing in AppleScript vs. in Javascript?

  3. Just to clarify, widgets/groups that aren’t visible will not run correct? (I think you answered this in another post but wanted to clarify)

Thanks again!

Ah ok, interesting!

1.) Blocking will block any other thing that is currently running in BTT. Usually you should use background - the priority is the same. Only use blocking if you need BTT to wait for the result.

2.) No real performance differences. Use what you like better.

3.) Yes they will only run when visible

1 Like