Jump to content

Add well-known and environment variables to Snippets


Recommended Posts

I like this idea, if I understand it correctly (see the attached image... am I close?). 

 

aText, the text expander app, has an identical feature to this.

 

In the meantime, perhaps you could create an "advanced snippet"? i.e., in a workflow, do Trigger -> Snippet, attach a Run Script action, insert something like

echo -n $MY_VARIABLE

 ...and then attach a Copy to Clipboard  ("expand immediately") as its output.

screenshot-20200804T211247.png

screenshot-20200804T212936.png

Link to comment
Share on other sites

11 hours ago, chris said:

auto-expansion snippets for well-known and environmental variables

 

What do you mean by “well-known variables”?

 

Environmental variables, by their own definition, exist within an environment, such as a specific session of your shell. To access them you have to define them, Alfred won’t automatically grab your shell’s startup files and interpret them—it doesn’t do that even for Workflows.

 

7 hours ago, Dattwood said:

create an "advanced snippet"? i.e., in a workflow, do Trigger -> Snippet, attach a Run Script action

 

This is the correct solution. The point of Workflows is that they expand Alfred’s native abilities, that’s the way to achieve what you want.

Link to comment
Share on other sites

On 8/4/2020 at 9:41 PM, Dattwood said:

I like this idea, if I understand it correctly (see the attached image... am I close?). 

 

aText, the text expander app, has an identical feature to this.

 

In the meantime, perhaps you could create an "advanced snippet"? i.e., in a workflow, do Trigger -> Snippet, attach a Run Script action, insert something like


echo -n $MY_VARIABLE

 ...and then attach a Copy to Clipboard  ("expand immediately") as its output.

screenshot-20200804T211247.png

screenshot-20200804T212936.png

 

Yes, that's about right. I think I was unclear in my terminology... maybe I mean OS-level CONSTANTS rather than "environmental variables". I'm not a developer, but I tinker in code, so clearly I don't always know what I'm doing. 

 

I think @vitor is probably right in that I should setup a workflow for this.. it just feels less convenient to have to bounce back and forth between the snippet editor and workflows to manage/edit my snippets. 

Link to comment
Share on other sites

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