BlueM / cliclick

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

Can't type with t: when sourcing from file #150

Open RichSimon opened 2 years ago

RichSimon commented 2 years ago

Running MacOS 12.4

Running from command line works, typing text (into say a browser window with Google docs):

cliclick c:455,442 t:randomtext

But running the same code from a file (with -f filename) is giving a strange response - so far for me it has opened the Mac control center, and other times it seems to right-click on a dock icon? Perhaps I'm missing something obvious.

As a side note, I think there's an issue with the help text for the t: command - it's referencing "type" instead of "t":

t:text Will TYPE the given TEXT into the frontmost application. If the text includes space(s), it must be enclosed in quotes. Example: “type:Test” will type “Test” Example: “type:'Viele Grüße'” will type “Viele Grüße”

BlueM commented 2 years ago

Could you please paste the file contents?

And regarding the help text: that’s an error indeed, thanks.

RichSimon commented 2 years ago

Simply:

c:600,600
t:random

Trying it now, it's bringing up the emoji panel and I get a few MacOS audible warnings ticks with the keys, when directing it to type into Google Docs in Safari. I tried including -e and -w CLI instructions along with the -f file read, but can't seem to get it to perform.

RichSimon commented 2 years ago

After a little more work, I think somehow the mac's Function key is getting triggered somewhere. I found I could type more reliably by prepending troublesome events with ku:fn to make sure it wasn't down.

BlueM commented 2 years ago

I am not able to reproduce this and have no idea what may cause this behavior. Does the same happen when reading from stdin? E.g.: cliclick -f - < test.txt or cat test.txt | cliclick -f -