F5 key via batch file

Joined
Dec 2, 2013
Messages
4
Reaction score
0
Computer illiterate senior -- has Pavilion Hp WIN7. Would like to have a batch file that automatically "presses" the F5 key on windows startup (to activate the keyboard backlighting). Any ideas?
 

Ian

Administrator
Joined
Oct 17, 2008
Messages
3,484
Reaction score
632
Welcome to the forums :).

Is it just F5 you need to press to get the keyboard backlighting, or do you need to combine this with some sort of secondary function key?

If it's just F5 that you need then you can do it via a VB Script file - create a file called "f5button.vbs" with the following code:

Code:
Set objShell = CreateObject("WScript.Shell")
objShell.SendKeys "{F5}"
You can run that file to send a virtual F5 keypress - or add it to startup to get it to run each time you boot. :)
 
Joined
Dec 2, 2013
Messages
4
Reaction score
0
Thank you so very much for the information. I just "toggle" the F5 key to engage the keyboard backlight so it sounds as though your idea will solve my problem. I do need further help -- I gather I open notepad and type the "code" information you provided into the text box and then save that to the startup folder. Is that correct?
 
Joined
Dec 2, 2013
Messages
4
Reaction score
0
Thank you so very much for the information. I just "toggle" the F5 key to engage the keyboard backlight so it sounds as though your idea will solve my problem. I do need further help -- I gather I open notepad and type the "code" information you provided into the text box and then save that to the startup folder. Is that correct?
I "built" the file (using notepad) as directed and saved it on the desktop as a .vbs file. I click on the icon (which I thought would be a good test to see if it works) and nothing happens. Further; I created a shortcut and dragged it into the startup folder (which I think is what makes it "work" with each startup) but, as before, nothing happens. The F5 key continues to work as always (toggles the backlight on/off).
I might add that when I click on the desktop icon or just restart the computer -- everything continues as normal (no error messages or indications).
 
Last edited:
Joined
Mar 8, 2009
Messages
5,063
Reaction score
1,185
I click on the icon (which I thought would be a good test to see if it works) and nothing happens. Further; I created a shortcut and dragged it into the startup folder (which I think is what makes it "work" with each startup) but, as before, nothing happens.
The startup folder would only automate the process of manually running the app. If the app doesn't work by clicking it, adding it to the startup folder will do nothing. The code should work before adding it to the startup folder. Wish I could help with the code, but unfortunately I know it's over my head.
 
Joined
Dec 2, 2013
Messages
4
Reaction score
0
Thanks for the input. I agree (just thought I'd try everything). I'm sure I have a self-imposed issue -- will keep at it though 'cause I think this is the right track to be on. Thanks again for the input and concerns. Happy Holidays -- no; MERRY CHRISTMAS!
 
Joined
Dec 3, 2013
Messages
1
Reaction score
1
Thanks for the input. I agree (just thought I'd try everything). I'm sure I have a self-imposed issue -- will keep at it though 'cause I think this is the right track to be on. Thanks again for the input and concerns. Happy Holidays -- no; MERRY CHRISTMAS!
You can try making that script but instead of
Code:
objShell.SendKeys "{F5}"
try using
Code:
objShell.SendKeys "^%{F5}"
That should send CTRL+ALT+F5(I may need to be corrected on my syntax).

EDIT: I thought I'd add my reasoning for why this is needed in case other people come with the same question. In the HP manual it says that if you're using an external keyboard that you must press CTRL+ALT then the hotkey and I am guessing that it would apply to script key presses too.
 
Last edited:
  • Like
Reactions: Ian

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top