Franck Dernoncourt
Franck Dernoncourt

Reputation: 83167

Sending the keyboard combo RWIN + shift + left with Dragon NaturallySpeaking's advanced scripting

I am trying to write a script that can send the keyboard combo RWIN + shift + left to move the selected window to the monitor to the left, with Dragon NaturallySpeaking's advanced scripting.

RWIN corresponds to the right windows key:

enter image description here

I tried:

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)
Wait(.2)
SendKeys "+({Left})"
Wait(.2)
keybd_event(VK_RWIN,0,2,0)
End Sub

But this sends shift + left followed by RWIN.

Upvotes: 1

Views: 370

Answers (1)

PGilm
PGilm

Reputation: 2312

Maybe add the wait flag to the SendKeys instruction. In that case, separate Wait steps may not be needed (and I commented them out). Try:

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)
    ' Wait(.2)
    SendKeys "+({Left})", 1  ' 1 = wait is true
    ' Wait(.2)
    keybd_event(VK_RWIN,0,2,0)
End Sub

Hth

Upvotes: 1

Related Questions