Controlling DwellClick with AppleScript
DwellClick can be controlled from AppleScript. This is useful if you want to connect DwellClick to a switch, voice command, macro utility, or other automation.
Turn DwellClick on or off
Use the enabled property to read or change whether DwellClick is active:
tell application "DwellClick"
set enabled to true
end tell
tell application "DwellClick"
set enabled to false
end tell
Ot toggle it:
tell application "DwellClick"
set enabled to not enabled
end tell
List the available actions
DwellClick provides scriptable action objects. To see the exact action names supported by your copy of DwellClick, run:
tell application "DwellClick"
get name of every action
end tell
The main actions are:
No-ClickClickDouble-ClickTriple-ClickDragControl-ClickOption-ClickShift-ClickCommand-ClickControl-DragOption-DragShift-DragCommand-DragMouse-UpPopup
Choose the next action
Use select when you want DwellClick to perform an action the next time the pointer dwells:
tell application "DwellClick"
select action "Double-Click"
end tell
For example, this tells DwellClick that the next dwell should start a drag:
tell application "DwellClick"
select action "Drag"
end tell
You can read the currently selected action with selected action:
tell application "DwellClick"
get name of selected action
end tell
The selected property is also available on each action:
tell application "DwellClick"
set selected of action "Control-Click" to true
end tell
Perform an action now
Use perform when you want DwellClick to act immediately if the pointer is already at rest. If the pointer is moving, DwellClick selects the action as the next action instead.
tell application "DwellClick"
perform action "Click"
end tell
tell application "DwellClick"
perform action "Shift-Click"
end tell
To show DwellClick’s popup panel from a script:
tell application "DwellClick"
perform action "Popup"
end tell
To release a drag that is currently held:
tell application "DwellClick"
perform action "Mouse-Up"
end tell
Example: choose from a menu
This script asks you which action to use, then selects it for the next dwell:
tell application "DwellClick"
set actionNames to name of every action
end tell
set chosenAction to choose from list actionNames with prompt "Choose the next DwellClick action:"
if chosenAction is not false then
tell application "DwellClick"
select action (item 1 of chosenAction)
end tell
end if
Notes
The action names are case-sensitive and must include the hyphens shown.