Jump to content

Using Snippet Triggers in Snippets?


Recommended Posts

Hi,

 

I'm new to Alfred, but currently grasping the possibilities of this fantastic tool.

After setting up some snippets for recurring email exchanges I encounter at work, I learned about Snippet Triggers and got myself the "Getting Started" workflow to understand them.

 

There is this \\greetmsg one that changes the greeting according to the time of day.

I would love to use that (and similar ones) in my snippets I have set up for email exchanges, but can't find a way to get it to work.

When pasting the \\greetmsg through a snippet, it does not execute unfortunately.

 

Any way to make this happen? I feel like I'm missing something.

I would love to go haywire with text templates if this sort of nesting is possible!

 

Im running Alfred 4.1 (Beta)

 

Cheers

 

Link to comment
11 hours ago, JulianW said:

I feel like I'm missing something.

 

Sounds like it. You can’t trigger a snippet by putting its keyword in another snippet. You have to actually type the keyword to trigger a snippet.

 

Alfred 4.1 (currently in pre-release) allows you to embed snippets in other snippets (using the {snippet:...} macro—you still can’t just write the other snippet’s keyword), but it doesn’t include Snippet Triggers. That’s not really feasible, as a Snippet Trigger might do anything.

 

You can do it the other way around, however, and use the {snippet:..} macro in a workflow triggered by a Snippet Trigger.

Link to comment
12 hours ago, deanishe said:

You can do it the other way around, however, and use the {snippet:..} macro in a workflow triggered by a Snippet Trigger.

 

Thank you for this input, how can I "chain" those workflows together though?

Let's say I want to set up a Snippet Trigger \\emailanswer and want to use \\greetmsg and \\hellomsg and \\thanksmsg throughout the snippet text?

 

How would I do that?

Link to comment

You set up your Snippet Trigger and script to generate whatever text, then in the Copy to Clipboard action it's connected to, you compose your snippet, e.g.:

 

{query}


{snippet:\hellomsg}


{snippet:\thanksmsg}

 

({query} is the output of the previous action.)

 

 

Link to comment

Appreciate you trying to help me!

 

Maybe I explained my idea not well enough, because your solution does not seem to address it.

I'll try again :)

 

I think I understand the thing with the {snippet: } macro, but this can only call snippets (the ones set up under "Features" -> "Snippets"), not Snippet Triggers (set up under "Workflows"), right?

 

I'm trying to call/integrate other Snippet Triggers within a Snippet Trigger.

Currently I'm just playing around with the "Getting Started" material for Snippet Triggers, that comes with Alfred.

 

There is no way of getting the following to work?

 

//greetmsg, //hellomsg

This is text from the email template blabla.

Best regards,

//thanksmsg

 

I understand, that the Snippet Triggers won't execute from pasting them, but can a workflow be set up in such a way, that it pastes a text that contains multiple queries it collected before?

 

Tried something like this, though this does not work so far for multiple reasons 😅

 

1985352298_Screenshot2020-07-08at10_20_41.thumb.png.744e096a8abbd126c579882dbf6b004e.png

 

 

Cheers

 

 

Link to comment
14 minutes ago, JulianW said:

I understand, that the Snippet Triggers won't execute from pasting them, but can a workflow be set up in such a way, that it pastes a text that contains multiple queries it collected before?


Yes, but you’d have to combine all the text-generating elements in one workflow, collect their output as variables, and then combine them in an Arg and Vars element or Copy to Clipboard Action using {var:...} macros.

Link to comment
1 hour ago, deanishe said:


Yes, but you’d have to combine all the text-generating elements in one workflow, collect their output as variables, and then combine them in an Arg and Vars element or Copy to Clipboard Action using {var:...} macros.

 

That sounds exactly like what I want to achieve.

 

Thank you!

 

I'll go ahead and learn about working with variables in Alfred.

 

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