I am using JavaScript for Automation in an Alfred workflow. I want to access the various environment variables that Alfred sets up. How do I access the environment variable like alfred_version?
1 Answer
I do not have Alfred installed however I would think the following method should work.
For example, using the Script Editor set to JavaScript the following code returned my login name.
ObjC.import('stdlib')
$.getenv('LOGNAME')
So, I'd assume that if "alfred_version
" is the actual environment variable, then the following might work as well.
ObjC.import('stdlib')
$.getenv('alfred_version')
-
Sorry. I have used these to get knowledge, but I think this is only my second question on one, and the only one that had an answer. I think I checked it now. But, I do not have enough reputation to upvote. Commented May 7, 2016 at 6:22
-
How do you set environment variables (in my case, for testing purposes)? Commented Sep 6, 2018 at 5:05