Copy Active Window Title to Clipboard Action

Hi there,
I'm looking for a way to copy the title of the active window to the clipboard. I see the "paste window title" action but not the "copy window title" option.

image
Thanks!
Craig

You can use the "Run Real java script action" with this script:

(async ()=> {


let windowTitle = await get_string_variable("focused_window_title");

await set_clipboard_content({content:windowTitle, format: 'NSPasteboardTypeString'})


returnToBTT(windowTitle);


})();

Brilliant!

A great use case for this is when using note-taking or project management apps, and you want to add a readable hyperlink to a page, for example "Copy Active Window Title To Clipboard Action", you can use this action, paste it into your tool, ⌘k, to add link then paste.

Perfect!

For that you might even be able to generate a full hyperlink if you add the active website url to the script:

(async ()=> {
let windowTitle = await get_string_variable("focused_window_title");
let windowURL = await get_string_variable("active_website_url");

let html = `<a href="${windowURL}">${windowTitle}</a>`;

await set_clipboard_content({content:html, format: 'NSPasteboardTypeHTML'})

returnToBTT(html);
})();

Generates this for the current topic on my machine:

Personal — Copy Active Window Title to Clipboard Action - Discussion & Questions - BetterTouchTool Community

It just gets better and better!

This tool and support community are amazing. I have been using it for years but have just begun to scratch the surface of its capabilities in the last year or so. Thanks for making my data-to-day workflow so much more efficient and enjoyable!

-Craig