andy4222 Posted July 30, 2022 Posted July 30, 2022 (edited) Hi Alfred team, I'm passing in args to Run Script, which will be used by the `open` command to open different browser modes. However, this command fails when I pass in the args. It works when I directly specify the command and not use args. It's something with the "space" character in the args but I can't seem to figure out what to change. Tried escaping with space with `\` and `\\` as well. Could you please help https://www.dropbox.com/s/my74m8uqk4pwnxy/Browser MODES - COPY.alfredworkflow?dl=0 Edited July 30, 2022 by andy4222
vitor Posted July 30, 2022 Posted July 30, 2022 Environment variables can only be strings, so the Run Script is seeing that command as a contiguous blob of text (as if it were between quotes). To have it run your string as if it were a command you can eval $appCommand but you should avoid eval. The proper way is to have the command itself in the Run Script. Also, escaping your spaces with \ quickly makes your code hard to read. Quote the text: open -a "Google Chrome" --args --incognito (you don’t need the full path with open -a). For more advanced use, you can also pass your separate arguments as JSON configuration, but for for now I recommend you use the method of having the command itself in the Run Script. andy4222 1
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