Meow
Meow

Reputation: 19141

How to send keystroke using VBScript?

I have screen capture software picPick and I've set hot key to take scrollable shots with CTRL + ALT + PRINT_SCREEN buttons.

My goal is to run the application, then press hotkey to capture the screen. But seems picPick is ran but SendKeys() are not doing anything I think, nothing occurs, what am I doing wrong?

VBScript

Set WshShell = WScript.CreateObject("WScript.Shell") 
WshShell.Run "C:\picPick"
WshShell.SendKeys("+^{PRTSC}")

I also tried simple print screen,

WshShell.SendKeys("{PRTSC}")

Then tried paste what I got onto MS Paint but nothing happened (i.e. screenshot btn wasn't pressed I believe)

Upvotes: 1

Views: 3843

Answers (1)

Helen
Helen

Reputation: 98001

As it is stated in the SendKeys method description:

You cannot send the PRINT SCREEN key {PRTSC} to an application.

The {PRTSC} code is probably reserved for future use, like in .NET SendKeys.Send.

Upvotes: 2

Related Questions