Jump to content

{query} seems to overwrite the system clipboard


Recommended Posts

I'm writing a simple script that takes

 

1. the currently highlighted text,

2. the clipboard text, 

 

And creates a new piece of text with both.  

 

Sadly it doesn't work because it looks like Alfred totally kills the clipboard text.

 

I have a workflow with

 

1. a hotkey with "pass through to workflow" and Argument set to "Selection in OS X"

2. A script.  

X=`pbpaste`
echo "[{query}](`pbpaste`)`echo $X`" | pbcopy

Basically, "X" is always set to "{query}".  It looks like Alfred totally kills the clipboard text when an argument is sent.

 

Can someone please verify this is a bug?

 

PS I'm looking for a way to highlight "foo" while "http://bar" is in the clipboard, and it generates markdown: [foo](http://bar)

Edited by jonmountjoy
Link to comment

I'm writing a simple script that takes

 

1. the currently highlighted text,

2. the clipboard text, 

 

And creates a new piece of text with both.  

 

Sadly it doesn't work because it looks like Alfred totally kills the clipboard text.

 

I have a workflow with

 

1. a hotkey with "pass through to workflow" and Argument set to "Selection in OS X"

2. A script.  

X=`pbpaste`
echo "[{query}](`pbpaste`)`echo $X`" | pbcopy

Basically, "X" is always set to "{query}".  It looks like Alfred totally kills the clipboard text when an argument is sent.

 

Can someone please verify this is a bug?

 

PS I'm looking for a way to highlight "foo" while "http://bar" is in the clipboard, and it generates markdown: [foo](http://bar)

 

As far as I am aware, it's not a bug. The only way for Alfred to get the current selection in another app is to trigger a pasteboard copy. I believe what you're really after is script access to the Alfred clipboard history.

Link to comment

Thank you.

 

Ah - so when Alfred records the "currently highlighted text" it effectively does it by overwriting the clipboard. 

 

Dang, so there's no way to implement this in Alfred then.

 

You're right - programmatic access to the clipboard history will help - but there doesn't appear to be any (that I could find).

Edited by jonmountjoy
Link to comment
  • 2 weeks later...

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...