2

My pc has the set of the fn keys to perfome actions like lower/raise the volume, active/deactive the mousepad, mic and webcam, etc. I formatted my pc yesterday (windows 10 if it matters) and all of them work except F8 (the webcam one). I can't really activate the webcam any other way that I know of. I've looked it up and found this question about activating the numlock key via powershell and tried with f8, but didn't work..

So I was wondering if there is any other way to activate the F8 key by cmd/powershell or to activate the webcam any other way?

oilijk
  • 21
  • 1
  • 2
  • If I understand you correctly it's not really F8 you want to press but the webcam button? If you push F8 through cmd/powershell then it will push F8 and not the webcam button. Your webcam button is actually just a link, find out what the link is, it's most likely something you can change in the keyboard settings. Or try the search function and search for webcam. It's probably the software that is not installed – Andreas Jul 21 '19 at 20:39
  • Yes, how do I do that? Sorry if this is really trivial I'm a certified wienie :/ – oilijk Jul 21 '19 at 20:56
  • Try to search for the name of the software. Push winkey and start typing the name of the software you used to with the webcam. If it's not found try and Google "[laptop manufacturer] webcam software" – Andreas Jul 22 '19 at 03:11
  • @Andreas It worked, please make an answer with your comments text so I can accept it and finish this discussion/give you credit! – oilijk Jul 22 '19 at 14:39
  • I appreciate the offer but I don't have all the details and my "answer" would just be lame. It's better that you post the answer and accept it. That way you can include what laptop manufacturer you got and how you found the software/solution that you used. – Andreas Jul 22 '19 at 15:52

2 Answers2

2

Sure there is a way to take actions of any key(s) on the keyboard, using many scripting languages. You've been able to do this for decades using VBScript. So, this is not a PowerShell thing.

Resources:

https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.sendkeys?view=netframework-4.8

https://www.jesusninoc.com/11/05/simulate-key-press-by-user-with-sendkeys-and-powershell

So, stuff like this... two ways to use this, the PowerShell way...

[System.Reflection.Assembly]::LoadWithPartialName("'Microsoft.VisualBasic") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms") | Out-Null
[System.Windows.Forms.SendKeys]::SendWait("{F8}")

The VBScript way, that you can also use exactly the same way.

$wshell = New-Object -ComObject wscript.shell
$wshell.SendKeys("{F8}")
postanote
  • 4,589
  • 2
  • 7
  • 7
  • Hello, turns out it's not the actual f8 key.. you can see the comment made by Andreas in the post.. he explains (better than me) that it's actual not f8 but a link in the f8 button – oilijk Jul 21 '19 at 20:58
  • Understood, but your question was specifically about how to emulate keystrokes. Yet, ditto to what Andreas gave you, but not all computers do this extended peripherals the same way. For example, there is no Webcam button on any system I have, though they all have web cams. There is Webcam software, that If I enable that, then I have to use what it maps out. Again, back to what Andreas is saying. – postanote Jul 22 '19 at 18:36
0

It may be a driver issue, since you formatted recently. Try going to Device Manager by pressing Windows+X, and then scanning the camera device for new drivers.

Good Luck and welcome to SuperUser!

Coder14
  • 14
  • 2