Typing Function Keys on Mac

Asked by John

I'm trying to type F3 to pan my windows onto the screen of my Mac using type(Key.F3), but it doesn't work, and there doesn't appear to be a KeyModifier for the "fn" key on Mac keyboards, so something like type(Key.F3, KeyModifier.FN) won't work because it isn't implemented. Any help typing F3 is appreciated.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

on my MacBook Pro OS X 10.11
type(Key.F12) # show Dashboard

works independently of the keyboard Preferences setting (use F1 ... F12 as standard function keys) and shows the Dashboard.

So if the use of F3 in your case is not systemwide, but app specific, you have to take care, that the app has focus.

Revision history for this message
John (aeronautix1) said :
#2

I am running Mac OS X 10.11.2
SikuliX IDE 1.1.0

Checking or unchecking Keyboard Preferences "Use F1- F12 as standard function keys" does not affect Sikuli in that it still doesn't allow me to utilize the functions of (dimming the light, raising the sound, panning windows), except for the following two function commands:

type(Key.F11) #Pan out windows and show Desktop
type(Key.F12) #Show Dashboard

So, what I'm getting at is that the following don't work to (dim lights, pan windows, alter keyboard LED lighting, raise/lower/mute sound), even with checking or unchecking "Use F1- F12 as standard function keys" in Keyboard Preferences.

type(Key.F1)
type(Key.F2)
...
type(Key.F12)

Any help is definitely appreciated.

Revision history for this message
Best RaiMan (raimund-hocke) said :
#3

The special features (shown above the Fx key notation on the key) cannot be accessed via type().

For some of these features, it is possible, to relate a function key in the Preferences (as in the standard for F11 and F12).
After you have done that, you can use type(Key.Fxx).

For other features you might use AppleScript snippets (http://sikulix-2014.readthedocs.org/en/latest/scripting.html#running-scripts-and-snippets-from-within-other-scripts-and-run-scripts-one-after-the-other)

Revision history for this message
John (aeronautix1) said :
#4

Thanks RaiMan, that solved my question.