outofgamut Posted May 5, 2023 Share Posted May 5, 2023 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? Thanks! Link to comment
Vero Posted May 5, 2023 Share Posted May 5, 2023 @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. 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. In the second object in blue, add your signatures. 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
outofgamut Posted May 6, 2023 Author Share Posted May 6, 2023 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
Vero Posted May 6, 2023 Share Posted May 6, 2023 @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
outofgamut Posted May 7, 2023 Author Share Posted May 7, 2023 With pleasure, @Vero Here we go: https://www.dropbox.com/s/f6237zfm2h8n9g5/Signature with quote.alfredworkflow?dl=0 Link to comment
vitor Posted May 8, 2023 Share Posted May 8, 2023 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
outofgamut Posted May 8, 2023 Author Share Posted May 8, 2023 (edited) Thanks, @vitor. Took your advice to heart and implemented it with one copy to clipboard and no pauses. Edited May 8, 2023 by outofgamut vitor 1 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