Jump to content

Snippet Script without Clobbering Pasteboard

Recommended Posts



i was curious if there was a way to make a custom snippet that runs a script and inserts the results inline without mucking with the pasteboard.


I usually keep something “important” in the most recent item of my pasteboard, even while typing snippets, so it’d be awesome to avoid clobbering that most recent item- I do have the transient checkbox ticked on my “Copy to clipboard” step, but that still makes it so the next time I go to paste the result from my command appears instead of the previous paste.



As an aside: is it possible to make native plugins? Right now my script takes a moment to run- I’m guessing it’s due to shell startup, as I’m just running ‘echo -n $(date +”%A, %B %-d”)’- it’d be cool to implement this natively to try and avoid any lag 😀 

Link to comment

@danzimm You can place the current clipboard text in a variable and then put the contents back again. Here is an example workflow:


https://www.dropbox.com/s/lqlbs99n3saokf9/Retain Clipboard.alfredworkflow?dl=0


Native plugins aren't possible, but scripts should run instantly with no lag. I just ran a quick internal test, and am seeing less than 1/100th of a second to setup, run and process the response from a Run Script object with a bash set as the language. What kind of lag are you seeing?




Link to comment
53 minutes ago, danzimm said:

I’m guessing it’s due to shell startup


Shell startup should be practically instantaneous. If it's slow, it might be loading all your dotfiles, which is generally considered a misconfiguration. Most of that stuff only wants loading in interactive sessions.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...