Script & Shortcuts Widgets

Script widgets are super powerful. They can run Apple Scripts, Apple Shortcuts, Shell Scripts and Java Script. By doing this they can obtain all sort of information and render that info to a Stream Deck button.

Formatting Output

There are multiple options to format the output of a Script Widget:

1.) Using the Appearance settings:

When using the appearance settings, BetterTouchTool will transfer the format for every line you defined to the script output. If the script output is longer than the string you defined, BTT will use the format of the last formatted character.

Using Regex To Switch Between Appearances

You can configure two apperances for a Script Widget. This includes all formatting options like background color, text formatting template, icons etc.

By default the "Default" appearance is used. However you can easily switch to the other appearance by providing a search string / regex. If the script output contains the defined search string or matches the Regex, it will activate the "Regex Matched Appearance".

In general the text configured in the appearance settings will be overriden by whatever text your script outputs. However you can choose to only use the script output for regex matching - so the script output will not change the text configured in the appearance settings. To do this check the "Do not update title based on script output - just use for regex matching and loading the configured appearance." checkbox below the script code.

2.) Returning HTML:

A Script Widget can return basic HTML to format:

3.) Returning JSON that describes appearance & new text to display

A Script Widget can return (escaped) JSON that defines the new text and new appearance properties. To get a list of all the supported properties it's easiest to configure a button to your needs. Afterwards copy & paste it into a Text Editor and have a look at the "BTTTriggerConfig" section in the JSON.

echo "{\"text\": \"Test\n\ntext\", \"BTTStreamDeckBackgroundColor\": \"100,100,100,255\"}"

Here is an example of supported properties

      "BTTStreamDeckImageHeight" : 46,
      "BTTStreamDeckCornerRadius" : 12,
      "BTTStreamDeckBackgroundColor" : "25.742586, 54.602200, 140.808355, 255.000000",
      "BTTStreamDeckOnlyOnSpecificDevices" : 1,
      "BTTStreamDeckIconColor1" : "255.000000, 255.000000, 255.000000, 255.000000",
      "BTTStreamDeckAlternateImageHeight" : 50,
      "BTTStreamDeckAlwaysShowButton" : 0,
      "BTTStreamDeckDisplayOrder" : 1000,
      "BTTStreamDeckAlternateIconColor1" : "255, 255, 255, 255",
      "BTTStreamDeckIconColor2" : "255, 255, 255, 255",
      "BTTStreamDeckAlternateIconColor2" : "255, 255, 255, 255",
      "BTTStreamDeckAlternateBackgroundColor" : "108.194754, 155.000000, 201.000000, 255.000000",
      "BTTStreamDeckAlternateIconColor3" : "255, 255, 255, 255",
      "BTTStreamDeckAlternateCornerRadius" : 12,
      "BTTStreamDeckIconColor3" : "255, 255, 255, 255",
      "BTTStreamDeckSN" : "CL48K2A00394"

Example Retrieve Bitcoin Price (Java Script):

results matching ""

    No results matching ""