cliclick icon indicating copy to clipboard operation
cliclick copied to clipboard

Issue with cliclick kp: commands on MacBook Sonoma

Open Pory55 opened this issue 1 year ago • 7 comments

Hi, I'm on MacBook Sonoma, and currently using cliclick version 5.1, installed via Homebrew. I've successfully implemented commands such as c:123,614, t:hello, and ku:cmd in scripts without any issues using Automator, Script Editor, or Terminal. However, I'm encountering a specific problem with kp: actions such as kp:volume-down, kp:arrow-up, kp:return or similar key press commands do not execute as expected. The script runs without errors, but no action occurs. I've checked command syntax and attempted various actions as listed in the documentation, but none of them for kp: seem to work. Any insights or suggestions on troubleshooting or resolving this issue would be greatly appreciated.

Pory55 avatar Jul 07 '24 01:07 Pory55

Hi @Pory55. I faced that too. I'm using this workaround with AppleScript. You can use any key on keyboard :)

tell application "System Events"
    -- Emulate Enter key
    keystroke return
end tell

vitor-rc1 avatar Jul 28 '24 01:07 vitor-rc1

Hello there. The same issue occurs. I executed this command in my terminal. When the kp: command is used frequently in a while loop, I observed irregular input.

while true; do
    cliclick "kp:arrow-left"

    sleep 0.1
done

kazkl avatar Aug 01 '24 12:08 kazkl

Seeing this too, it is driving me crazy! Specifically with sleep 3; for i in {1..100}; do cliclick -w 100 -m verbose kp:arrow-down; done

stephen714 avatar Aug 07 '24 06:08 stephen714

@Pory55: do you experience the kp issue with any key, or just specific ones? And is the problem reproducible (e.g. kp:volume-down never works) or is it randomly? What keyboard layout are you using?

@stephen714: I don’t know what you are trying to accomplish, but maybe you should experiment with executing the commands within a single cliclick invocation. Something like …

commands=$(printf 'kp:arrow-down%.0s ' {1..100})
cliclick -w 100 -m verbose $commands

BlueM avatar Nov 10 '24 10:11 BlueM

See comment https://github.com/BlueM/cliclick/issues/164#issuecomment-2466781818 for a potential solution.

BlueM avatar Nov 10 '24 15:11 BlueM

To clarify my last comment: “potential solution” does not mean “fix it yourself”, but rather “I’d be interested to hear if the problem can be solved with the small change in above-mentioned comment”.

BlueM avatar Nov 15 '24 18:11 BlueM

Copy that! My bad; I think I got a bit excited. To answer your question, I compiled that small change in your above-mentioned comment and it seems like the problem can be solved (i.e. cliclick kp:arrow-down, and other presses, actually work). Sorry for being a nuisance! 😄

stephen714 avatar Nov 16 '24 20:11 stephen714