Dragon NaturallySpeaking: switching between Studio 2017 and Notepad

Due to Studio's lack of support for Dragon NaturallySpeaking I am composing most of my text in Notepad. Does anyone have any tips for macros to select all the text in Notepad then switch reliably to Studio's editing pane? (Too often I find that I end up in the concordance pane or some other subsection of the main window.)

I watched Nora's webinar a couple of weeks ago and found it useful, but have not yet bought the KnowBrainer utility, nor have I had time to implement any of her suggestions myself.

I have a very large project under way today, and already my left hand is starting to feel the impact of repeated alt+tabs from Notepad to Studio, so I am looking for some kind of short-term fix. I can look into something more sophisticated at a later date.

I am using Studio 2017 and Dragon Professional Individual.

Thanks in advance,
Dan

  • For now, a small autohotkey script seems to do the trick. Note that control + shift + e is nominally the shortcut for the editor, BUT the shortcut doesn't seem to work if I am in something like the concordance window i.e. It does not move to the target pane. Apologies for dodgy code formatting. Any suggestions still gratefully received.

    ; WinActivate SDL Trados
    if WinExist("ahk_exe SDLTradosStudio.exe")
    {WinActivate SDL Trados
    {If WinExist("wip - Notepad")
    ;MsgBox, "found notepad for SDL"
    WinActivate ; use the window found above
    else
    MsgBox "Notepad not running"
    WinWaitActive
    send ^a
    sleep 50
    send ^c
    sleep 100
    WinActivate SDL Trados
    send ^+e
    sleep 50
    send ^a
    sleep 50
    send ^v
    }
    }

  • Hi Dan,

    I think the inability to select a specific view part in Studio is frustrating. I have also experimented with a couple of AHK scripts for other things that I can't get to work reliably because I occasionally end up in the wrong view part.

    A few suggestions: did you try Dragon's own dictation window instead of Notepad? It has a bulit-in "Transfer" button and it will automatically transfer the text for you to the segment where your cursor was when you started.

    My second suggestion, although I understand you're pressed for time, is that KnowBrainer has a 30-day free trial, so no need to make a financial commitment right away.

    And the last one is, since you have the Professional version of Dragon, you don't really need KnowBrainer, you can write your scripts directly in Dragon, if you want to go that route.

    Happy dictating!

  • Hi Dan,

    Sorry for not replying sooner!

    I am not sure whether this is the default, but I have "Activate Display Filters" set to the keyboard shortcut Ctr-Alt-F6.
    When I use this shortcut, the cursor returns to the current target segment if it is anywhere else in the Editor pane. Try it out.

    I also defined some handy keyboard shortcuts for use in DPI commands:

    Editor (pane) Ctr-Alt-Shift-E  <--- use to move to the Editor pane
    Files (pane) Ctr-Alt-Shift-F
    Projects (pane) Ctr-Alt-Shift-P
    Reports (pane) Ctr-Alt-Shift-R
    Welcome (pane) Ctr-Alt-Shirt-W

    and

    Options (dialog) Ctr-Alt-Shift-O

    When you are ready to move from Word or Notepad or whatever to Studio, write your DPI command so that it switches to Studio, then uses Ctr-Alt-Shift-E to make sure you are in the Editor pane and then uses Ctr-Alt-F6 to make sure you are in the current target segment.

    Best regards,
    Bruce Campbell
    ASAP Language Services

  • If anyone is curious, here are the DPI commands I use to copy a series of segments from Word to Studio. (See at the end of this post)

    I dictate into Word. At the end of each segment, I dictate a "new line" to insert a hard line break (CRLF: carriage return + line feed).

    When I have a series of segments, each in its own paragraph, I move to the top of the list and use the command "copy list" (see below). This command copies the segments in each paragraph, stores them in the registry and then switches to the current target segment in Studio.

    (Note that a soft line break in Word (LF: line feed) will be converted to a soft line break in Studio.)

    In Studio, I then use the command "paste list" to copy what were originally paragraphs in Word one-by-one into the segments.

    If I want to skip over one or more segments (e.g. they already have translations), then I insert a paragraph that only has "<>" in it.

    Whenever the "paste list" command finds a paragraph that is "<>" it uses the Ctrl-Down command to skip over everything to the next unconfirmed segment. Then it continues pasting. When everything has been pasted, it moves back up to the first segment that was pasted. I then review and confirm the segments one-by-one in Studio.

    Sometimes you get a surprise trying to use the "<>" to skip over segments (e.g. you miss a segment when you are dictating, so your sequence of segments does not match the sequence in Studio). So once I have translated a section I generally do a spellcheck, then a verify and lock them, so they don't accidentally get overwritten. (I have other Dragon commands that help with this.)

    If your sequence of segments in Word does not match the sequence in Word, you will notice this when you review the segments in Studio. It is usually not a big problem. You just confirm down the list of segments as far as you can in Studio and then go back to Word, make any changes needed and start the "copy list" command again part way down in your original list of segments in Word.

    Anyway, here are the Dragon commands. You might have to change the times in the "Wait" commands if your system is faster or slower than mine.

    The two commands use a crazy conversion routine to change each Unicode character to three ASCII characters. Before I added this conversion I had trouble with special Unicode characters, accented characters, etc. being converted to something else when they were pasted into Studio. The conversion is a bit complicated because I had to avoid the null ASCII character, which the registry uses to signal the end of a string.

    Best regards,
    Bruce Campbell
    ASAP Language Services

     

    DPI command: “copy list”

    (I set this command to be active when I am in a particular Word file I have named “SDL.docx”)

    Sub Main

    Dim i, j, k, a, b, c As Integer

    CR$ = Chr$(13)

    LF$ = Chr$(10)

    CRLF$ = CR$ + LF$

    T$ = ""

    Do

      SendKeys "^+{Down}", True       ' copy next paragraph into S$

      SendKeys "^c", True

      Wait 0.1

       S$ = Clipboard$()

      SendKeys "{Right}", True            ' go to start of next paragraph

      S$ = Replace(S$, CR$, "")             ' get rid of CRs and trailing LF

      If Right(S$,1) = LF$ Then S$ = Left(S$, Len(S$) - 1)  ' there could still be

      S$ = Trim$(S$)                                                       ' LFs in the string

      If Len(S$) <> 0 Then T$ = T$ + S$ + CRLF$   ' add S$ and CRLF to end of T$

    Loop Until Len(S$) = 0   ' loop until you get an empty paragraph

    If Len(T$) <> 0 Then

      List$ = ""

      i = 1

      j = Len(T$)

      Do

        k = AscW(Mid(T$,i,1))         ' convert each character in T$ to a

        c = (k And 127) Or 128       ' crazy ASCII equivalent that can

        k = (k And 65408)\128        ' be stored in the Windows registry

        b = (k And 127) Or 128

        k = (k And 65408)\128

        a = k Or 128

        List$ = List$ + Chr(a) + Chr(b) + Chr(c)

        i = i+1

      Loop Until i > j

    End If

    SaveSetting "MyDNS", "MyList", "List", List$   ' save the whole thing in the registry

    HeardWord("switch", "to", "SDL Trados Studio")   ' switch to Studio

    Wait 0.5

    SendKeys "^%+E",True     ' switch to the Editor pane

    Wait 0.1

    SendKeys "^%{F6}",True   ' go to the current target segment

    Wait 0.1

    End Sub

     

    DPI command: “paste list”

    (I set this command to be active when I am in SDL Trados Studio)

    Sub Main

    Dim i, j, k, a, b, c As Integer, x as Long

    CR$ = Chr$(13)

    LF$ = Chr$(10)

    CRLF$ = CR$ + LF$

    T$ = GetSetting$("MyDNS","MyList","List")   ' get the text from the registry

    List$ = ""

    i = 1

    j = Len(T$)

    Do

      a = Asc(Mid(T$,i,1))

      i=i+1

      b = Asc(Mid(T$,i,1))

      i=i+1

      c = Asc(Mid(T$,i,1))

      i=i+1

      x = (a And 127)                       ' convert from crazy ASCII coding

      x = x*128 + (b And 127)          ' back to original text

      x = x*128 + (c And 127)

      List$ = List$ + ChrW(x)

    Loop Until i > j

    i = 1

    j = InStr(i, List$, CRLF$)         ' find the first original paragraph

    k = 0

    Do While j <> 0      

      S$ = Mid(List$, i, j-i)

      If S$ = "<>" Then                        ' if you find a paragraph that is "<>"

        SendKeys "^{Down}", True         ' then skip to next unconfirmed segment

      Else

        Clipboard S$                              ' copy paragraph to the clipboard

        SendKeys "^a", True                  ' and use it to replace whatever is

        SendKeys "^v", True                  ' in the target segment

        SendKeys "{Right}", True           ' move to the next segment in Studio

      End If

      i = j + 2                            ' skip over CRLF

      j = InStr(i, List$, CRLF$)    ' find the next paragraph

      k = k + 1                          ' keep track of how many segments you have moved down

    Loop

    Wait 0.1

    SendDragonKeys "{Ctrl+Up " & k & "}"    ' move up the same number of segments

    End Sub

  • I forgot to mention once again that the Ctr-Alt-Shift-E shortcut used in the commands above is not a standard Studio shortcut.

    If you use the DPI commands above, you will have to set this as the shortcut for the Editor (panel).

    And check that Ctr-Alt-F6 is the shortcut for "Activate Display Filters". I don't know any more whether this is a standard Studio shortcut.

    Best regards,
    Bruce Campbell
    ASAP Language Services

  • Thank you Nora, I don't know if it is only me, but I find Dragon's own dictation window to be sluggish compared to Notepad. I need something with a bit of snap and it seems that Notepad is the only text editor out there that has full compatibility with Dragon. I have tried dozens, literally, but only Notepad seems to work well.

    I was interested in KnowBrainer because, longer term, I am interested in implementing some of the macros for selecting text and so on in Studio that you mention in your video. Of course, if I can accomplish the same thing within Dragon Professional, that's fine by me, but I haven't yet explored that. I had assumed, perhaps wrongly, that the functionality was limited.

    Bruce, thank you for sharing your macros, which are fascinating. I can see that these could be very useful, particularly if you had a large number of relatively short segments. Is the step of saving the text in the registry just a "belts and braces" thing for extra security? It doesn't appear to be strictly necessary, at least as far as I can see.

    Regards,
    Dan
  • Hi Dan,

    I want to stress that given how much I use these two Dragon commands (and other related Dragon commands), the time spent coding them was well worth it. After battling with Studio, it is a luxury to be able to dictate into Word.

    Given the length of the bug list, I don't see Studio becoming Dragon-friendly in the foreseeable future, if ever.

    I also want to stress that I do not use the Dragon commands just for "relatively short segments".

    I use these commands most of the time when I have long sections of text to translate and don't want to fuss around with Studio, which is a real pain when it comes to Dragon.

    I just want to dictate one sentence after another and correct things easily, which is possible in Word. When I am translating this way, I don't focus on the segments in Studio. I create a PDF version of the source file and display it on another screen. (One screen at the left for Studio so I can keep track of where I am, one screen in the center for the PDF source file, and one screen at the right for the Word file I am translating into. I am planning on adding another video card and at least one other screen for dictionary searches, Internet searches, displaying reference/glossary files, etc.)

    So I first pre-translate a file, go through all of the draft segments created by the pre-translation (I have a Dragon command that uses the Ctr-G (go to next) Studio command to go to the next segment with a status of "Draft"). Once I have confirmed all of the pre-translated segments, I spellcheck them, verify them and then lock them so that they are not included in any future analyses, spellchecks, verifies, etc.

    Then I start at the top of the (PDF) file and start dictating into Word. I keep an eye on Studio to see where the next confirmed segments are and dictate an "insert skip" when needed (a Dragon command to insert a new line, followed by "<>" and another new line, signalling that the "paste list" command should skip down to the next unconfirmed segment). If I need to check terminology or how I translated a certain phrase before, I switch to Studio and check the termbase, or highlight the text in the source segment, and do a concordance search.

    When I have dictated a section of text and feel like reviewing what I have done, I do a "copy list", "paste list" and then start reviewing and confirming the draft segments one after another in Studio.

    In my view, this review is an essential step when working with Dragon. There is a good chance that Dragon misunderstood something you dictated (by the way, the likelihood of Studio misunderstanding is higher in Studio than it is in Word), and this review is your chance to catch Dragon's mistakes before you confirm the segments. Everyone who works with Dragon does this review at some time. By doing it later in Studio, I don't have to concentrate so carefully on what I am dictating into Word. I can focus fully on the flow of the text I am translating, knowing that I will be reviewing everything later. If you dictate into Studio and review each segment immediately after dictating it, then your attention and the flow of the text is interrupted at each and every segment.

    I also periodically run analyses of the file in Studio and if there are a significant number of good matches I will run another pre-translation to handle those segments before I start dictating batches again.

    So I basically use Studio (1) to periodically find good matches in the TM and then handle them with pre-translation, and (2) as a terminology reference using termbases and concordance searches. I find Studio very good at handling these two things, but find that it interrupts the flow of translation when I have large sections of text to handle.

    I will dictate directly into Studio if I have a file that only has scattered segments to translate (cursing all the while about the problems with working with Dragon in Studio).

    With regard to limitations on storing strings in the registry, according to Microsoft (see "Registry Element Size Limits"), the size limit on values in the registry is "Available memory (latest format) / 1 MB (standard format)".

    So it looks like strings can be at least 1 MB long, which would be quite a few characters. I generally translate batches of 300 to 1000 words, which is nowhere near this limit.

    Using the registry seemed the fastest, easiest way to communicate between Dragon commands. (I did not want to fuss around with opening and closing, reading and writing to a file... and the timing for accessing the registry is probably more reliable than accessing a file. Getting the timing right with "Wait" statements is important when writing Dragon commands.) The restriction to ASCII characters only came to light later, when I noticed special characters changing when transferred from Word to Studio. My first attempt to convert each Unicode character to ASCII characters ran into the null ASCII character being interpreted as the end of string in the registry, so I figured out an easy way to break a Unicode character into three ASCII characters, making sure there was a "1" bit at the start of each one, so I never ended up with a null character.

    If there is another (quick, easy and reliable) way to pass information from one Dragon command to another, please let me know. It could come in handy in the future.

    And one final comment: If you use Dragon with Studio, and find Dragon suddenly slowing to a crawl for no apparent reason, check the Windows Task Manager for an "EXCEL.EXE" process (in the Details tab in Windows 10). If you are using Excel, then close it. If you are not using Excel, or the Excel process keeps on running, then terminate it. This will hopefully allow Dragon to speed up again.

    Best regards,
    Bruce Campbell
    ASAP Language Services

  • Hi Dan,

    I'm sure after seeing Bruce's excellent ideas and implementation you have some guidance of what to do if you want to dictate outside of Studio while still working on a Studio file.

    I can't really comment on the speed of the dictation window, as I don't use it at all, I dictate directly into Studio, but given your listed requirements, would also like to suggest having a look at this:

    rnam.net/.../

    I find the add-on offered there very interesting, but I haven't tried it myself because like I said, I dictate directly into Studio and the other benefits of the add-on have been resolved with AutoHotkey for my needs.
  • Thank you for being so generous with your advice Bruce. I will definitely check for a background Excel process next time.

    Dan
  • Thank you Nora, I have bought that add-on and will try it out.

    Dan