BlueM / cliclick

macOS CLI tool for emulating mouse and keyboard events
https://www.bluem.net
Other
1.59k stars 116 forks source link

run with macOS "Shortcuts.app" #158

Closed upstroke-version closed 1 year ago

upstroke-version commented 1 year ago

I've installed cliclick with homebrew and it works well on terminal. But when i try to run script with Shortcuts app with "Run Shell Script", it shows error. I'm trying to run this script

/opt/homebrew/opt/cliclick -r -w 1000 dd:100,100 du:100,100

and this shows error like this /var/folders/dy/x1077t110_z5xcr6m4w1wmjr0000gn/T/com.apple.WorkflowKit.BackgroundShortcutRunner//2C12CBA9-BC6A-4066-A9DA-06A1F24047A3:1: permission denied: /opt/homebrew/opt/cliclick

1

I've tried changing the file permission for /opt/homebrew/Cellar/cliclick/5.1/bin/cliclick, gave Accessibility permission for Shortcuts.app, Terminal and /opt/homebrew/Cellar/cliclick/5.1/bin/cliclick and it shows the same error.

upstroke-version commented 1 year ago

I've solved this by replacing "/opt/homebrew/opt/cliclick" with "/opt/homebrew/Cellar/cliclick/5.1/bin/cliclick", but I'm not sure this is a right way to do this... My workaround would break when cliclick updates and changes version, right?

BlueM commented 1 year ago

At least it looks like it will break. But that’s merely a guess, since I’ve only superficial knowledge of Homebrew (I don’t maintain the cliclick formuala myself). Not to mention that my Homebrew installation is in /usr/local, not in /opt.

Regarding the root cause of the problem: I’v never used the Shortcuts app, but have you tried to uncheck the “Run as administrator“ checkbox? These looks counterproductive to me. If that doesn’t help, what’s the output of ls -l /opt/homebrew/opt/cliclick?

upstroke-version commented 1 year ago

I've solved this issue few days ago by replacing "/opt/homebrew/Cellar/cliclick/5.1/bin/cliclick" with "/opt/homebrew/bin/cliclick". I forgot to write here after solving the issue. Sorry for bothering you. I will now close the issue.