Ovi Posted November 4, 2018 Posted November 4, 2018 Hi, It would be nice to have the option to edit the selected item in the clipboard before pasting. Thank you. manavortex, Hevisko and brank87 3
manavortex Posted November 7, 2018 Posted November 7, 2018 Yes, please. The ability to edit clipboard contents is something that Alfred is sorely lacking.
Vero Posted November 7, 2018 Posted November 7, 2018 @manavortex @Ovi What kind of modification do you have in mind when wanting to change text in the item you've copied to clipboard? To be clear, we have no intention of adding a text editor to Alfred to edit arbitrary text before pasting, but there may be some clever ways you can do what you want with a workflow or snippet. For example, if you have text that you want to paste with a few repeated changes every time (e.g. change someone's name, the price of something, etc), that could be achieved using a dynamic placeholder in a snippet. It's a much more efficient way and predictable way to paste something with specific elements changed every time. If that's what you have in mind, take a look at the built-in workflow Getting Started > Snippet Triggers to see them in action. You'll also find a tutorial on using Snippet Triggers with dynamic content here: https://www.alfredapp.com/help/workflows/triggers/snippet/snippet-triggers-with-dynamic-inputs/ If you have something else in mind, do share, as there may very well be ways to do it already Cheers, Vero CJK 1
manavortex Posted November 12, 2018 Posted November 12, 2018 (edited) Hey, my main use case is copying URLs from Safari and removing the referrers via regex. Currently I'm doing it via keyboard maestro, my regex (for now) is ((\??(ref|src|fb[a-z]{4,}|utm_source)=.+))(.*) If I have an URL like https://www.boredpanda.com/funny-internet-comics/?utm_source=facebook&utm_medium=social&utm_campaign=BPFacebook& that basically leaves https://www.boredpanda.com/funny-internet-comics/ Since Alfred already has a builtin clipboard manager, it would be my tool of choice. What I'd like would be one of the following: Trigger an Alfred workflow on external clipboard change (to avoid endless recursion) Advantage: Greater flexibility Disadvantage: Another kind of trigger that you might not want to replace A feature to the Alfred clipboard manager to replace clipboard content based on rules Advantage: More foolproof Disadvantage: Would probably require major changes..? Please let me know how I can achieve that with built-in means! Edited November 12, 2018 by manavortex wrong syntax highlighting
CJK Posted November 12, 2018 Posted November 12, 2018 Not a complete solution, but this establishes a hotkey that takes highlighted text in Safari, runs it through your regex, then sends the result to the clipboard. Here, I've elected to use 〈Ctrl〉+〈C〉 as a close relative of 〈Cmd〉+〈C〉. manavortex 1
bmamlin Posted February 5, 2021 Posted February 5, 2021 I ran into a case where I wanted to copy & paste a little recipe of commands with small changes that varied each time I used the recipe. Rather than making an Alfred workflow for the specific task, I thought it would be more useful to simply copy my recipe and then edit it before pasting. Surely Alfred would help me with that! 😀 A google search for "alfredapp edit clipboard" led me to this thread, but not to the solution I was seeking. So I thought I would share my solution... My solution for this was to use an editor (in my case Sublime Text) that supports editing of stdin. Sublime Text offers a command line option for editing stdin in the form: subl - That will open the editor with the contents of stdin and return whatever is saved from that editor to stdout. All I needed to do was pipe the clipboard into this and then send the output back to the clipboard. That's a piece of cake for Alfred. So, I chose a hotkey (⌥⇧V) to be my "edit before paste" hotkey and linked it to a bash script with this single line: pbpaste | /Users/username/bin/subl - where "username" is my MacOS username. This needs to be have the full path to the subl command (which you can find from the terminal using "which subl". I could get something like "$(which subl) -" or "$(command -v subl) - " to work to avoid having to hardcode the full path. Finally, the output from the editor is passed to a Copy to Clipboard output (with "Automatically paste to front most app" selected). With this workflow, if I want to edit the clipboard before pasting, I press ⌥⇧V, my editor comes up with the clipboard contents, I make my edits & save, and the edited value gets pasted into whatever app I was in when I pressed the hotkey. Voilà!
Hevisko Posted February 3 Posted February 3 On 11/7/2018 at 5:47 PM, Vero said: What kind of modification do you have in mind when wanting to change text in the item you've copied to clipboard? So, I have this brain dead bank with their ultra fancy Javacript that .. well... it break things like entering cellphone numbers, where it contains spaces where you copied it from, and the input box then totally stop right there in it's tracks and you can't paste the rest. ie. the data I'm pasting: 78 123 674 the effect in the input box: 78 as the space then stops any further input /parsing ;( to be able to remove the spaces in THIS case, would be fantastic (actually to also remove tabs will be a blessing in other cases)
Stephen_C Posted February 3 Posted February 3 Does the data have to come from the clipboard? Is it standard on each occasion or is it some changeable code? If standard you might consider a workflow that incorporates the Replace utility—so long as you don't mind working with Regular Expressions. Stephen
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now