BlueM / cliclick

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

Feed command a variable? #140

Open dannydav709 opened 2 years ago

dannydav709 commented 2 years ago

I am wondering if it is possible to give the "c: ...." command a variable instead of a number. I would like to set the value of the variable to be a number based on the current resolution of the screen, since my computer is used in different scenarios with different monitors.

BlueM commented 2 years ago

The command you pass to cliclick is a string. By inserting a variable into that string, you can effectively use a variable. How to do that depends on the programming language used. For instance, in a Bash script, code such as this could be used:

width=$(system_profiler SPDisplaysDataType | fgrep Resolution | awk '{print $2}')
cliclick m:$width,200