Skip to main content

Scripting BTT

BetterTouchTool has a generic scripting interface (see below). Depending on your use case, you can access it in several ways:

Floating WebView / HTML Menu: If you use BetterTouchTool's Floating Web View, you can also access the scripting interface directly from its HTML/JavaScript: Trigger from Floating Web View

These are the available scripting interfaces: (see the individual scripting pages for examples)

  • trigger_named
  • update_touch_bar_widget
  • update_stream_deck_widget
  • update_menubar_item
  • trigger_action
  • execute_assigned_actions_for_trigger
  • refresh_widget
  • get_trigger
  • get_triggers
  • update_trigger (creates a trigger, or updates it if it already exists)
  • add_new_trigger
  • delete_trigger
  • delete_triggers
  • trigger_named_async_without_response
  • cancel_delayed_named_trigger_execution
  • run_shortcut
  • run_shortcut_async_without_response
  • get_dock_badge_for
  • get_active_touch_bar_group
  • is_true_tone_enabled
  • is_app_running
  • get_location
  • get_weather
  • set_persistent_string_variable
  • set_string_variable
  • set_persistent_number_variable
  • set_number_variable
  • get_number_variable
  • get_string_variable
  • get_variable_type
  • export_preset
  • import_preset
  • get_preset_details
  • get_menu_item_details
  • paste_text
  • get_clipboard_content
  • set_clipboard_content
  • set_clipboard_contents
  • get_selection
  • get_items_from_clipboard_manager
  • paste_clipboard_manager_items_with_uuids
  • show_simple_json_format_menu
  • reveal_element_in_ui
  • display_notification
  • chat_gpt

Floating Menus:

  • update_menu_item
  • get_menu_item_value
  • set_menu_item_value
  • webview_menu_item_load_html_url_js

Note: BTT also has some built-in variables that can be very helpful:

Built-In Scripting Variables