Hey command

Hello,

is there a way to control the mouse with “hey” command?

René

That’s not how Hey works. Hey works as a substitute for the mouse. So instead of clicking an app to position X,Y on the screen you can use Hey to send the equivalent command. But you won’t see the mouse move. There may be a technique to create mouse events, but Hey doesn’t do that.

If you’re trying to get it to press a button for you, rather than trying to move the mouse to the button etc, use Hey to tell the button to do a press.

You can turn on a checkbox or press a button if you know the name of the checkbox and the name of the view it is in and the name of the window the view is in and the name of the application the window is in. Hey can be used to find that out (with getsuites to find out what commands a particular object understands, get InternalName to get a name, etc) as well as to do the actual checkbox setting.

For example, paste this into a Terminal window to show it setting and clearing the checkbox for showing time zone in the Time preferences. It fires up the preferences, switches to the tab with the checkboxes, then checks the box, then unchecks it, then quits the Time preferences.

/boot/system/data/deskbar/menu/Preferences/Time & sleep 1s hey Time set Selection of View "tabView" of View "baseView" of Window "Time" to 3 sleep 1s hey Time set Value of View [2] of View [1] of View "show clock box" of View "Clock" of View "view container" of View "tabView" of View "baseView" of Window "Time" to 1 sleep 1s hey Time set Value of View [2] of View [1] of View "show clock box" of View "Clock" of View "view container" of View "tabView" of View "baseView" of Window "Time" to 0 sleep 1s hey Time quit

I used names to identify Views whenever they had a name, had to use a number for some of them since the original programmer didn’t specify a name.

To find out names and what’s there, I’d use commands like:

Fri Apr 15 11:25:50 527 /boot/home>hey Time get InternalName of View [0] of View “tabView” of View “baseView” of Window "Time"
Reply BMessage(B_REPLY):
“result” (B_STRING_TYPE) : “view container”
“error” (B_INT32_TYPE) : 0 (0x00000000)

Fri Apr 15 11:36:04 564 /boot/home>hey Time get Label of View [2] of View [1] of View “show clock box” of View “Clock” of View “view container” of View “tabView” of View “baseView” of Window "Time"
Reply BMessage(B_REPLY):
“result” (B_STRING_TYPE) : “Show time zone”