Jump to content

Automatically copy selected text when Alfred is invoked


ctwise
 Share

Recommended Posts

See this conversation - http://www.alfredforum.com/topic/5137-services-and-workflows/

 

It would be extremely useful if Alfred automatically copied any selected text to the pasteboard when it was invoked, and, when Alfred closes, clean up the pasteboard if it hasn't otherwise changed. For example, if the pasteboard looked like this:

 

    "Some old text on the pasteboard"

 

But the user selected the text:

 

    "I want this text auto-copied"

 

Then the "I want this text auto-copied" would be sitting on the pasteboard when Alfred was invoked, before workflows executed.

 

When Alfred closes, if the auto-copied text was still sitting on the pasteboard, Alfred should restore the original text to the pasteboard, adjusting pasteboard history as appropriate. The intent being that workflows can get access to selected text when Alfred is invoked or ignore it if they're not interested and not be surprised by the pasteboard containing something when they didn't explicitly invoked copy.

 

At the moment this behavior requires creating a hot-key and requesting that the selection in OS/X should be passed through. See http://www.packal.org/workflow/funnel for an example of a workflow that uses this feature to implement text filters on selected text.

 

But, if the requested feature were implemented then funnel/filter-like workflows could be broken up into individual workflows that acted on text selections instead of requiring a different hot-key for each separate workflow.

Link to comment
Share on other sites

I think a {selection} token, used like {query}, would be a better solution. Internally, Alfred captures the selected text on opening and passes the text of the cached selection to instances of {selection}.

Then the original clipboard should be preserved to prevent confusion for other apps that depend on the clipboard (like MenuClip). Alfred has had to deal with other apps that hijack the clipboard; it seems silly to do implement a similar behavior into Alfred himself…

Please correct me if I'm misunderstanding the technical details

Link to comment
Share on other sites

I think a {selection} token, used like {query}, would be a better solution. Internally, Alfred captures the selected text on opening and passes the text of the cached selection to instances of {selection}.

Then the original clipboard should be preserved to prevent confusion for other apps that depend on the clipboard (like MenuClip). Alfred has had to deal with other apps that hijack the clipboard; it seems silly to do implement a similar behavior into Alfred himself…

Please correct me if I'm misunderstanding the technical details

 

There's a big problem with that - large amounts of text.

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...