cliclick icon indicating copy to clipboard operation
cliclick copied to clipboard

Feed command a variable?

Open dannydav709 opened this issue 2 years ago • 1 comments

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.

dannydav709 avatar Mar 08 '22 22:03 dannydav709

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

BlueM avatar Mar 10 '22 21:03 BlueM