Hello! Please tell me how can I launch a trigger in the email writing window using shortcuts for the Send Later button, which is located in the toolbar?
Only with UI-Scripting (AppleScript):
tell application "System Events"
tell application process "Mail"
set frontmost to true -- only required if executed in script editor
tell window 1
tell toolbar 1
tell group 1
tell group 1
click menu button 1
end tell
tell menu 1
repeat with menuItem in menu items
if name of menuItem contains " …" then
tell menuItem
click
end tell
exit repeat
end if
end repeat
end tell
end tell
end tell
end tell
end tell
end tell
Shortcut (for Paste in BTT-Mail-Configuration):
[
{
"BTTLastUpdatedAt" : 1695030506.4118509,
"BTTTriggerType" : 0,
"BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut",
"BTTPredefinedActionType" : 366,
"BTTPredefinedActionName" : "Empty Placeholder",
"BTTAdditionalConfiguration" : "655394",
"BTTKeyboardShortcutKeyboardType" : 0,
"BTTUUID" : "1E8AB42A-66AF-402A-977A-2E0F634F593C",
"BTTTriggerOnDown" : 1,
"BTTNotesInsteadOfDescription" : 1,
"BTTLayoutIndependentChar" : "p",
"BTTEnabled" : 1,
"BTTEnabled2" : 1,
"BTTShortcutKeyCode" : 35,
"BTTShortcutModifierKeys" : 655360,
"BTTAutoAdaptToKeyboardLayout" : 0,
"BTTAdditionalActions" : [
{
"BTTLastUpdatedAt" : 1695030261.4126501,
"BTTTriggerType" : -1,
"BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut",
"BTTPredefinedActionType" : 172,
"BTTPredefinedActionName" : "Apple Script starten (blockierend)",
"BTTAdditionalActionData" : {
"BTTScriptType" : 0,
"BTTAppleScriptRunInBackground" : false,
"BTTTouchBarAppleScriptString" : "tell application \"System Events\"\n\ttell application process \"Mail\"\n\t\ttell window 1\n\t\t\ttell toolbar 1\n\t\t\t\ttell group 1\n\t\t\t\t\ttell group 1\n\t\t\t\t\t\tclick menu button 1\n\t\t\t\t\tend tell\n\t\t\t\t\ttell menu 1\n\t\t\t\t\t\trepeat with menuItem in menu items\n\t\t\t\t\t\t\tif name of menuItem contains \" …\" then\n\t\t\t\t\t\t\t\ttell menuItem\n\t\t\t\t\t\t\t\t\tclick\n\t\t\t\t\t\t\t\tend tell\n\t\t\t\t\t\t\t\texit repeat\n\t\t\t\t\t\t\tend if\n\t\t\t\t\t\tend repeat\n\t\t\t\t\tend tell\n\t\t\t\tend tell\n\t\t\tend tell\n\t\tend tell\n\tend tell\nend tell\n",
"BTTTouchBarAppleScriptUsePath" : false
},
"BTTInlineAppleScript" : "tell application \"System Events\"\n\ttell application process \"Mail\"\n\t\ttell window 1\n\t\t\ttell toolbar 1\n\t\t\t\ttell group 1\n\t\t\t\t\ttell group 1\n\t\t\t\t\t\tclick menu button 1\n\t\t\t\t\tend tell\n\t\t\t\t\ttell menu 1\n\t\t\t\t\t\trepeat with menuItem in menu items\n\t\t\t\t\t\t\tif name of menuItem contains \" …\" then\n\t\t\t\t\t\t\t\ttell menuItem\n\t\t\t\t\t\t\t\t\tclick\n\t\t\t\t\t\t\t\tend tell\n\t\t\t\t\t\t\t\texit repeat\n\t\t\t\t\t\t\tend if\n\t\t\t\t\t\tend repeat\n\t\t\t\t\tend tell\n\t\t\t\tend tell\n\t\t\tend tell\n\t\tend tell\n\tend tell\nend tell\n",
"BTTKeyboardShortcutKeyboardType" : 0,
"BTTUUID" : "8B9A55BF-251D-4446-9F53-5379D7598B47",
"BTTEnabled" : 1,
"BTTEnabled2" : 1,
"BTTShortcutKeyCode" : -1,
"BTTShortcutModifierKeys" : -1,
"BTTOrder" : 329,
"BTTAutoAdaptToKeyboardLayout" : 0
}
],
"BTTGestureNotes" : "Send Later"
}
]
Edited: The popup menu seems to change throughout the day.
Dirk's solution is best, just a note for users who have no UI-Scripting experience:
With the new BTT versions >= 4.259, you can also use the "Find Image On Screen & Move Mouse" actions combined with the "Wait For Image To Become Visible" action like this:
So basically it first searches for the dropdown arrow, moves the mouse there and performs a left-click. Then it waits for the "Send later" image to become visible, moves the mouse and does a left-click there.
This is not as performant as UI scripting, but good enough for most cases.
Sometimes it can be tricky to record screenshots of the areas you want to click using BTT's built-in area-chooser, in such cases I recommend to use the macOS screen capture utility to do so.
In my experience, this greatly depends on the resolution of the screens. In my office, I have a configuration with three monitors, and at home, I have two. The monitors have varying resolutions, and not all elements that should be recognized actually do so. It consistently functions only on the setup where it was initially configured.
Yep that's true, although this has improved a lot with the new versions. Previously BTT could only find exact matches, now it can find "similar" or differently sized ones also.