BTT's customVariable related one

Hey Andreas,

I'm setting BTT's customVariable1 == 1 (number var) like this:

[
  {
    "BTTActionCategory" : 0,
    "BTTIsPureAction" : true,
    "BTTPredefinedActionType" : 292,
    "BTTPredefinedActionName" : "Assign or Set Value for Variable",
    "BTTVariableType" : 1,
    "BTTVariableName" : "customVariable1",
    "BTTVariableValue" : "1",
    "BTTEnabled2" : 1,
    "BTTOrder" : 8
  }
]

But when I then use this var in CAG like shown below it seem that the comparison doesn't works - check the below screenshot. If I change the type to Text (BTTVariableType == 0), then the condition becomes "true"

I've tried removing the quotes in the condition builder, but this is reverted if I click on Save. (maybe this is root cause based on the below test?)

It seems that the issue is only present when using CAG, because when using "Advanced Conditions", the conditions is True:

2 additional minor things:

  1. In the 1st screenshot customVariable{4,5} are missing the "BTT Variable:" prefix

  2. Are you planing to add the same feature from "Advanced conditions", where you can add the variables to the condition builder with the arrow buttons:

Can someone test this to confirm or deny this? You can copy the code and paste in as an action in any trigger.

@xidiot I confirm that I am experiencing the same issue: the CAG conditions do not function when I set customVariable1 to Variable type: Number, but they do work when I set it to Text.

I believe this issue may be related to type casting or coercion.

Specifically, consider the following steps:

  1. Assign customVariable1 to type Number and set the value to 1.
  2. Assign customVariable2 to type Text and set the value to 1.

When you run these commands in the terminal, the outputs are not the same:

osascript -e 'tell application "BetterTouchTool" to get_number_variable "customVariable1"'
1.0
osascript -e 'tell application "BetterTouchTool" to get_string_variable "customVariable2"'
1

This discrepancy suggests that the handling of number and text variables is inconsistent.

1 Like

The CAGs currently don't load these variables dynamically and always expect a string value. Thus it'll fail if the variable type had been set to number in the "set variable value" action.

I plan to have a common condition editor UI for both CAGs and ATCs soon, that will resolve this.

2 Likes

Thank you both!