Hey all, I'm trying to do something pretty simple: I want to flip an environment variable between two values based on a hotkey.
I found this syntax for modifying my environment variable ("selector"), and it appears to work... Kind of.
ObjC.import('stdlib');
Application('com.runningwithcrayons.Alfred').setConfiguration('selector', {
toValue: 'option1',
inWorkflow: $.getenv('alfred_workflow_bundleid'),
exportable: true
});
The script runs and all seems well. If I view the environment variable by clicking the [x], it's different! But if I then go to print the value of "selector" (say, using the "large type" output) it doesn't always update. It seems to switch but only after a few minutes. I want it to change immediately, and be accessible immediately.
Previously I was doing this without any trouble by writing to and reading from a text file – this was flawless, and would persist between different workflows as well, but I felt like I should do it the "right" way and use "real" variables. Is there any way to make this work?