Jump to content

(Email signature): Write text and get line of text from file triggered by snippet

Recommended Posts

I am struggling with achieving the following:


Call a snippet with my standard snippet group assignment prefix (^) to insert my signature, followed by a random line from a textile (containing quotes).


I do have a Bash script that pulls the text and copies it to the clipboard. Ideally, I'd like to trigger a snippet via text that then calls a workflow. Seems that I can't do that but have to create a workflow with a snippet trigger. This changes my prefix from my usual one to a separate prefix I need to assign to workflows - which throws a spanner in the works for me.


Is there really no way to call a workflow from a standard snippet?



Link to comment

@outofgamut If I understand correctly your objective, you want to type a snippet and have a random signature from a pre-defined selection pasted?


Here's a workflow I created to help another user, which you might enjoy using. It doesn't require any scripting, and can all be done within Alfred's Workflow Editor.

  1. In the yellow object, set your snippet keyword, which will be typed along with any prefix/suffix you've globally set for snippet triggers. You can set this prefix to the same as your usual one. So long as the keywords don't conflict, you can use the same prefix.
  2. In the second object in blue, add your signatures.


Screenshot 2023-05-05 at 09.18.32.png


There are more details on configuration in the About This Workflow once you import it, but I think you'll work it out very quickly :)


https://www.dropbox.com/s/kg8wqem8rgn5z54/Random Signature.alfredworkflow?dl=0


If I've missed any particular feature you're looking for, let me know and we'll help you further :)

Link to comment

Thanks a lot for your help, @Vero!


I have a _long_ list of quotes that I want randomly inserted, so I wanted to keep them in the text file (which also makes maintenance easier) rather than a list field in Alfred.


I have it working now. I had run into issues with my first clipboard paste - my signature - not coming through and only my second paste - the quote - turning up twice. Turns out I needed to insert a little pause (slow, slow, slow is the way to go) in order to make it work:



Link to comment

@outofgamut If you share your workflow (modify to remove personal details first if you prefer), we might be able to help you merge the signature and the quote into a single pasted item instead by adding the quote as a variable in the Copy to Clipboard object. :)

Link to comment

The way the pasting works is that the text is first copied and then pasted. Because you have two pastes happening so close to each other the events are trampling over themselves. Which is why the delay works.

The solution is to have just one paste, the last one. Use the contents of the first one and use {query} for the contents of the Run Script. Read the grey text on the Copy to Clipboard, it explains this in detail.

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