bdf7kt
bdf7kt

Reputation: 162

How to press the Fn + function keys on Windows?

In previous scripts, I have been able to use the SendKeys method to press non-alphabetic keys on my computer like the following to simulate muting, WshShell.SendKeys(chr(&hAD)).

However, I cannot seem to find the ability to simulate pressing Fn and any of the F1-F12 keys. I am trying specifically to press the "Lower Screen Brightness" key, which is Fn+F11 on my keyboard.

How can this be accomplished?

Upvotes: 2

Views: 5599

Answers (1)

BoffinBrain
BoffinBrain

Reputation: 6525

The Fn keys on a laptop are usually implemented at the hardware or driver level. See: the answer to a similar question: How to press Fn+F11

Your best bet is to find a method of performing the action directly from the OS rather than trying to press a key that doesn't 'exist' as far as Windows is concerned. In the case of screen brightness, there are other ways to do that. This solution is written in C# but if you really needed to do it in VBScript, you could potentially write a COM or DLL to handle it.

Upvotes: 1

Related Questions