Jump to content
aik099

Select text and use it

Recommended Posts

Hi,

 

I have this text shown in text editor (note empty line after):

JRA-123 - Task Title

and some https://www.example.com/dynamic URL in clipboard and I want to combine them into this, that will replace original text in editor:

Fixes JRA-123 - Task Title

Differential Revision: https://www.example.com/dynamic

and I want to use "Snippet Trigger" for that with "fx" keyword so that I've type "fx" in any editor place and replacement happens.

 

I've faced couple of problems so far:

  1. sending "Command+A" shortcut to the text editor via "Output > Dispatch Key Combo" can't be done as workflow action (in the middle) - I've tried to select text and immediately use selection inside Alfred
  2. capturing selected text can only be done via "Triggers > Hotkey" and it can't be used as workflow action (in the middle) as well - I've tried to capture what should be selected above

 

Thanks.

Edited by aik099

Share this post


Link to post

GUI automation, like sending keyboard shortcuts, is error prone and should be done as a last resort. Ideally, your editor would support AppleScript and you could control it that way. Another safer way to approach it would be selecting the text yourself and using the Hotkey, but you’ve already excluded that.


Caveats out of the way, it can indeed be done but it won’t be pretty. You’ll need to connect a Snippet Trigger to a Dispatch Key Combo Output (⌘A) that connects to another Dispatch Key Combo Output (⌘C) that connects to a Copy to Clipboard Output. Because this will finicky and some actions can trample others, make sure to add a Delay Utility between each step (0.5 seconds might suffice).

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...