Franck Dernoncourt
Franck Dernoncourt

Reputation: 83167

How can I send a right windows key with Dragon NaturallySpeaking's advanced scripting?

How can I send a right windows key with Dragon NaturallySpeaking's advanced scripting?

enter image description here

Looking at What is the difference between the commands SendKeys, SendSystemKeys or SendDragonKeys? it doesn't seem possible with SendKeys, SendSystemKeys or SendDragonKeys.

Upvotes: 1

Views: 965

Answers (2)

Dan
Dan

Reputation: 11

Note the Declare stuff has to be ABOVE the Sub Main in your script. Then this is what it will look like if you're using a modifier key:

Declare Function keybd_event Lib "user32.dll" (ByVal vKey As Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long
Const VK_LWIN = 91

Sub Main

keybd_event(VK_LWIN,0,0,0)
SendSystemKeys "{Right}"
keybd_event(VK_LWIN,0,2,0)

Upvotes: 1

Franck Dernoncourt
Franck Dernoncourt

Reputation: 83167

Pressing the right windows key:

' From https://knowbrainer.com/forums/forum/messageview.cfm?catid=3&threadid=3032
' Author: monkey8
' Tested with Dragon NaturallySpeaking 12.5 with Windows 7 SP1 x64 Ultimate
Declare Function keybd_event Lib "user32.dll" (ByVal vKey As _
Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long
Const VK_RWIN = 92
Sub Main
keybd_event(VK_RWIN,0,0,0)
'if you want to send a key while holding down the Windows key then insert the code here
keybd_event(VK_RWIN,0,2,0)
End Sub

Pressing the left windows key:

' From https://knowbrainer.com/forums/forum/messageview.cfm?catid=3&threadid=3032
' Author: monkey8
' Tested with Dragon NaturallySpeaking 12.5 with Windows 7 SP1 x64 Ultimate
Declare Function keybd_event Lib "user32.dll" (ByVal vKey As _
Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long
Const VK_LWIN = 91
Sub Main
keybd_event(VK_LWIN,0,0,0)
'if you want to send a key while holding down the Windows key then insert the code here
keybd_event(VK_LWIN,0,2,0)
End Sub

Useful reference for the keyboard codes: List of Virtual Key Codes (mirror)

Upvotes: 1

Related Questions