Ovi Posted November 4, 2018 Share 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. brank87 and manavortex 2 Link to comment Share on other sites More sharing options...
manavortex Posted November 7, 2018 Share Posted November 7, 2018 Yes, please. The ability to edit clipboard contents is something that Alfred is sorely lacking. Link to comment Share on other sites More sharing options...
CJK Posted November 7, 2018 Share Posted November 7, 2018 You could use the Transform utility to edit it. Link to comment Share on other sites More sharing options...
Vero Posted November 7, 2018 Share 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 Link to comment Share on other sites More sharing options...
manavortex Posted November 12, 2018 Share 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 Link to comment Share on other sites More sharing options...
CJK Posted November 12, 2018 Share 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 Link to comment Share on other sites More sharing options...
bmamlin Posted February 5, 2021 Share 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à! Link to comment Share on other sites More sharing options...
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