Search code examples
naturallyspeaking

How can I we represent a new line character in the Clipboard in an Advanced Scripting command?


I am writing an Advanced Scripting voice command in Dragon NaturallySpeaking Professional 11.5 to write some MATLAB usual figure commands by voice, namely:

title('')
xlabel('')
ylabel('')

As I would like to write these three lines in one voice command, and the fastest way two output text using Advanced Scripting is to put the text within the keyboard and press Ctr+v, I'm looking for a way to represent new line characters in the Clipboard.

My current script is the following:

Sub Main
    Clipboard("title(''); xlabel('') ; ylabel('');")
    SendKeys "^v"
    SendKeys "{Enter}"
End Sub

and output:

title(''); xlabel('') ; ylabel('');

Solution

  • vbCrLf will add a new line:

    Sub Main
        Clipboard("title('')" & vbCrLf & "xlabel('')" & vbCrLf & "ylabel('')")
        SendKeys "^v"
        SendKeys "{Enter}"
    End Sub
    

    will output:

    title('')
    xlabel('')
    ylabel('')