Jump to content

Adding Content to Front and Back of Selection


Recommended Posts

I am looking to create a workflow that does this..

 

 

if I had some text on a page like this....

 

Test Text

 

And I select that text, then use a keyword or shortcut, it would apply <strong> before and </strong> after

 

I have already set something up like this but it requires me to cut the text out, use my keyword, paste the text into alfred and then it will apply the styling.

 

Is there anyway to make alfred do this without having to cut it and paste it back in?

 

 

Link to comment

Is there anyway to make alfred do this without having to cut it and paste it back in?

 

 

Yes and no.

 

It's trivially easy to tell Alfred to use the current text selection via a Keyword object.

 

However, there's no reasonable way to replace that selection without using the pasteboard.

Link to comment

Here's a more detailed description of how to set this up - this still relies on the clipboard but it doesn't affect clipboard history, and allows to select text and hit a hotkey rather than going through the manual steps you describe:

 

create a new blank workflow

 

add a hotkey, and select Action: Pass through to workflow and Argument: Selection in OS X

 

add a run script action with the following config set in the dropdowns:

 

Language: /bin/bash

with input as argv

 

for the script you can use

query=$1

echo -n "<strong>"$query"</strong>"

Then add a Copy to Clipboard action with {query} in the text box and both checkboxes below checked.

 

then connect them all and add your hotkey

Link to comment
  • 9 months later...
On 6/22/2016 at 4:32 PM, dfay said:

add a hotkey, and select Action: Pass through to workflow and Argument: Selection in OS X

 

 

Any way to do this but via a keyword instead of a hotkey? I'm trying to tweak your excellent Case Converter workflow so that I can select some text, then call up Alfred and type "case" and have it drop down a list of my options, or maybe just type "sentence case" (eventually just "se" would do it) to go right to that option. There are only so many hotkeys I can remember…

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