Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to run script in Automator #13

Closed
bremere opened this issue Oct 7, 2019 · 13 comments
Closed

unable to run script in Automator #13

bremere opened this issue Oct 7, 2019 · 13 comments

Comments

@bremere
Copy link

bremere commented Oct 7, 2019

I can run a script that was generated just fine within the terminal window, and it works great! I'm trying to run the script in automator and always generates an error.

The script is:
displayplacer "id:4FA1B805-30CE-5C25-29B6-D8D149F68FEC res:1920x1200 color_depth:8 scaling:off origin:(0,0) degree:0" "id:54EF03AE-1045-6AAE-C0BD-AC5CACC7C273 res:1920x1200 color_depth:8 scaling:off origin:(1920,0) degree:0"

and the error in automator is:

"displayplacer: command not found"

What am I missing? seems pretty straight forward and I just can't get it to work :(

@jakehilborn
Copy link
Owner

Try putting the full path to the executable. Use which to find that path. For example

~ $ which displayplacer
/usr/local/bin/displayplacer
~ $ /usr/local/bin/displayplacer "id:4FA1B805-30CE-5C25-29B6-D8D149F68FEC res:1920x1200 color_depth:8 scaling:off origin:(0,0) degree:0" "id:54EF03AE-1045-6AAE-C0BD-AC5CACC7C273 res:1920x1200 color_depth:8 scaling:off origin:(1920,0) degree:0"

@jordanjennings
Copy link

If you have installed an updated version of bash with homebrew and set it to your default shell (as I have), then Automator tries to use it by default but it doesn't seem to work. I had to manually change the Shell dropdown in Run Shell Script to /bin/bash and use the full path to displayplacer, and now it's working.

Not working:
image

Working:
image

@bremere
Copy link
Author

bremere commented Oct 11, 2019

Thank you both! I was able to get Automator to behave, you've both been great help!

@bremere bremere closed this as completed Oct 11, 2019
@re-evgeny
Copy link

Thank you guys, exactly what I was looking for!

@leongeyer
Copy link

leongeyer commented Jun 1, 2020

Hi. If somebody has the inverse problem, where Automator points to /bin/bash, but display placer is on /usr/local/bin/ which does not appear in the dropdown menu, insert
export PATH=/usr/local/bin:$PATH at the beginning of the script. Taken from https://apple.stackexchange.com/questions/97502/my-automator-workflow-fails-because-it-fails-to-find-the-git-command-within-the.
I am on OS10.14.6

@kastuin
Copy link

kastuin commented Jul 23, 2020

Thanks for this I was getting very frustrated with automator ;) @jordanjennings

@Grimwoooo
Copy link

Excellent! This solved my same problem. Thank you Jake! I love Displayplacer so much!!

@FloWi
Copy link

FloWi commented Nov 28, 2021

@jordanjennings Thanks for the info regarding the path. Automator was driving me crazy :)

@JamIsJam88
Copy link

Sorry, I'm new to Automator and recently installed Homebrew just for this. Can I create this as a Quick Action and assign it to a hotkey as a service shortcut? If so, the following code is not working in a Shell Script where the shell is /bin/bash:

/usr/local/bin/displayplacer "id:FAEBDFC2-38F5-4C8E-8F51-14139CA13140 res:1920x1080 hz:144 color_depth:8 scaling:off origin:(0,0) degree:0" "id:37D8832A-2D66-02CA-B9F7-8F30A301B230 res:1512x982 hz:120 color_depth:8 scaling:off origin:(-1512,0) degree:0" "id:8309CC09-D4BD-4FC8-BCC1-4EE98CF9F500 res:1920x1080 hz:60 color_depth:7 scaling:off origin:(0,-1080) degree:0"

I get the error No such file or directory.

@leongeyer
Copy link

leongeyer commented Jan 27, 2022

Try to write this:
export PATH=/usr/local/bin:$PATH displayplacer "id .... and so on

rest the same:
workflow receives no input in any app
/bin/bash pass input to stdin

@JamIsJam88
Copy link

JamIsJam88 commented Jan 27, 2022

Hey thanks! However, it keeps giving me an error stating displayplacer: command not found. I can get it to work in the terminal without the export path.

Try to write this: export PATH=/usr/local/bin:$PATH displayplacer "id .... and so on

rest the same: workflow receives no input in any app /bin/bash pass input to stdin

@Zuxaw
Copy link

Zuxaw commented Jan 27, 2022

Hi if it doesn't work with all the above solutions you can do :
brew info displayplacer

image
You will get your current displayplacer location

Then you can put in your automator :
/opt/homebrew/Cellar/displayplacer/1.2.0/bin/displayplacer

image

@JamIsJam88
Copy link

Hi if it doesn't work with all the above solutions you can do : brew info displayplacer

image You will get your current displayplacer location

Then you can put in your automator : /opt/homebrew/Cellar/displayplacer/1.2.0/bin/displayplacer

image

This worked perfectly. Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants