It is indeed rather strange. I am not sure in which types of apps it is effective and in which types it is not. I have tested many applications. This is related to the application and has nothing to do with whether the selected text is read-only text, an editable edit box, or an HTML document. However, I have not summed up any rules. Just when I was writing this feedback, I don't know what was triggered. In Vivaldi, it seems that I can pop up the menu again.
Hey, congrats on the baby and love this idea!! Thanks so much! It wasn't working at first in Chrome, but after a few minutes it did, and it's awesome! love the abilities!
So not sure if this is the right place for this, but is there anyway to use regex for the Trigger conditions? For example, I have case numbers that are always 8 digits and I want a certain menu to only appear when I select text that matches that pattern. I got it to work with a specific selected text string, but having it based on a pattern would help in a lot of cases!
I don't know very much about PopClip's capabilities but from a first quick look I don't think BTT has limitations compared to it. I'd think BTT's floating menus are much more flexible. However of course this feature is only 2 days old, so I'm sure there will be various edge cases that are already handled in PopClip that BTT does not yet. Please report anything you can find!
E.g. your command can be run using the "Run Shell Script" action, the variable would need to be replaced with {BTTTextSelection}
In general you can use all of BTT's scripting capabilities, easiest via the "Run Real Java Script action - that can also be generated best by ChatGPT, just point it to the docs: Using Java Script (not JXA) · GitBook and tell it the selected text is available via the BTTTextSelection variable
Maybe there are currently some limitations working with formatted text, modifying formatted text will be possible with one of the next BTT versions.
your youtube download command (downloading to ~/Downloads). However currently you really need to select text that contains a full youtube link. Selecting formatted text with links is not yet possible. E.g. selecting this: willnotworkyet. I'll add an option to access the raw html source of a selection soon.
apple maps search
run selection in terminal
The preset now also shows how to hide e.g. the cut item if the current context doesn't allow cutting, or the paste item if the current context doesn't allow pasting.
I'm really liking how well this is working so far!
I noticed that whenever I'm on YouTube and want to use yt-dlp, I have to click and drag over the url for the pop-up to work. Would it be possible to have the pop-up happen whenever cmd-L is typed or just "clicking" inside the url bar to select the full YouTube link? It's extra steps to click inside the url bar and then drag to select the whole thing.
in safari the latest version 5.089 should allow clicking the address bar. Showing it via keyboard command (cmd+l) is also possible, I‘ll post an example tomorrow
Thanks! Awsome! Tried to change the yt-dlp to work all websites with chatgpt. But i just think it screwed it up. haha
function extractFirstLink(text) {
// This regex will match:
// 1) Optional protocol (http:// or https://)
// 2) Optional "www."
// 3) Any domain and optional trailing path/query
const linkRegex = /(?:https?:\/\/|www\.)[^\s"'`<>]+/i;
const match = text.match(linkRegex);
if (!match) {
return null;
}
let found = match[0];
// If the matched URL doesn't start with protocol, prepend "https://"
if (!/^https?:\/\//i.test(found)) {
found = 'https://' + found;
}
return found;
}
async function downloadVideo() {
let selectedText = await get_string_variable("BTTTextSelection");
let link = extractFirstLink(selectedText);
// If no valid link is found, exit early
if (!link) {
return null;
}
let shellScript = `/opt/homebrew/bin/yt-dlp \\
--output "~/Downloads/%(title)s.%(ext)s" \\
-f "bestvideo+bestaudio/best" \\
--no-part \\
--prefer-ffmpeg \\
--ffmpeg-location "/opt/homebrew/bin/ffmpeg" \\
--remux-video mp4 \\
"${link}"`;
let shellScriptWrapper = {
script: shellScript
};
// Execute the shell script
let result = await runShellScript(shellScriptWrapper);
return shellScript;
}
function extractFirstLink(text) {
// This regex will match:
// 1) Optional protocol (http:// or https://)
// 2) Optional "www."
// 3) Any domain and optional trailing path/query
const linkRegex = /(?:https?:\/\/|www\.)[^\s"'`<>]+/i;
const match = text.match(linkRegex);
if (!match) {
return null;
}
let found = match[0];
// If the matched URL doesn't start with protocol, prepend "https://"
if (!/^https?:\/\//i.test(found)) {
found = 'https://' + found;
}
return found;
}
async function itemScript(itemUUID) {
let content = {
BTTMenuItemVisibleWhileActive: 0,
BTTMenuItemVisibleWhileInactive: 0
};
let selectedText = await get_string_variable("BTTTextSelection");
if (extractFirstLink(selectedText) != null) {
content = {
BTTMenuItemVisibleWhileActive: 1,
BTTMenuItemVisibleWhileInactive: 1
};
}
return JSON.stringify(content);
}
再次感谢您的付出,希望可以超越popclip,我觉得肯定会,加油
I just used the latest version 5.089 and also used the newly shared presets. However, I still cannot obtain pop-ups in many apps. The apps I currently encounter are: office word/excel, obsidian. Thanks again for your efforts. I hope it can surpass popclip. I think it will definitely happen. Come on!
I want to use the submenu. However, after clicking on the submenu, I don't know how to return to the main menu. How can I set it up so that when the submenu is hovered over, it expands without covering the display of the main menu, just like in the above picture?
Here is an example preset that shows how to do submenus. You can either use floating menu submenus, or you can assign the predefined action "Show Custom Context Menu (New)" to a menu item.
This preset also shows a few things that are new in v5.090:
there is a new predefined action "Change Formatting Of Selected Text"
Can be used to change colors and sizes of selected text
there is a new predefined action "Run Text Selection Change Detection"
Can be used to show the menu even if you selected the text via keyboard. For example if you select text via shift + opt + arrow left/right, this preset defines a key sequences "double press option key" that will show the text selection menu when pressing opt twice. It also calls the menu when pressing cmd+L to select the addressbar.
Noticed a bug while playing som chess in safari. Every time i moved a piece i heard the macos "bop" sound. Nothing activated in the recently used list. Checked with KeyCastr and noticed that if you click-drag the mouse and release in safari Better Touch Tools sends "cmd C".
Its only if you drag where there is no text, for ex if you play chess. It stops if I turn off the text selection menu preset.
Btw how many Better Touch Tools users are there? If thats not a company secret. Or around how many active licenses are there?
I couldnt use a computer without it. But it does take a long time to grasp all the functions.