jonmountjoy Posted December 9, 2014 Share Posted December 9, 2014 (edited) 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 December 9, 2014 by jonmountjoy Link to comment
ctwise Posted December 9, 2014 Share Posted December 9, 2014 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
jonmountjoy Posted December 11, 2014 Author Share Posted December 11, 2014 (edited) 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 December 11, 2014 by jonmountjoy Link to comment
deanishe Posted December 19, 2014 Share Posted December 19, 2014 Dang, so there's no way to implement this in Alfred then. Sure there is. You need to grab the contents of the clipboard and then trigger the copy event yourself, though, via AppleScript instead of using Alfred's built-in Get Selection action. Link to comment
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