![]() |
KnowBrainer Speech Recognition | ![]() |
Topic Title: How to bring the mouse to the cursor position Topic Summary: (I know I have asked before...) Created On: 02/17/2022 03:57 AM Status: Post and Reply |
|
![]() |
![]() |
- Anandits | - 02/17/2022 03:57 AM |
![]() |
![]() |
- Matt_Chambers | - 02/17/2022 09:29 AM |
![]() |
![]() |
- Edgar | - 02/17/2022 09:43 AM |
![]() |
![]() |
- Alan Cantor | - 02/17/2022 10:04 AM |
![]() |
![]() |
- Ag | - 02/18/2022 02:07 AM |
![]() |
![]() |
- Ag | - 09/02/2022 01:10 PM |
![]() |
![]() |
- Robert Snow | - 02/18/2022 09:18 PM |
![]() |
![]() |
- dilligence | - 02/19/2022 08:51 AM |
![]() |
![]() |
- Alan Cantor | - 02/19/2022 12:37 PM |
![]() |
![]() |
- Anandits | - 09/01/2022 01:40 AM |
![]() |
|
Some time ago I also asked this question, and it gave interesting discussion but no answer. I wonder if by now maybe someone happened to find a solution to this...
I would like to have a command that is taking the mouse cursor to the insertion point. It is very tedious to navigate to a certain place in a document, and then execute a mouse command and lose your place. I am currently for instance trying to practice using SP's WinPress, or SpeechStarts's 'Left Mouse Down' command to try to select text. (for instance, if I want to highlight a few lines in a paragraph). (In Dragon unfriendly environments, especially Google docs). I would have navigated to a certain position by saying things like "go down 5"..."go right 3 words...", And when I finally get where I want to be, it is annoying to realize I have left the mouse cursor behind and have to start all over again.
There might be other solutions for this particular Problem, but this is just one example. I would love a way to "call" the cursor and have it join the insertion point. (I don't know if I'm using the right terminology).
|
|
|
|
![]() |
|
I don't know the answer and can't find one anywhere on this forum, surprisingly. Seems like there ought to be a sensible solution. |
|
|
|
![]() |
|
It might also be possible using a fairly small C# application. There's a snippet from a post on stackoverflow.com, posted by BrendanMcK: GetGUIThreadInfo() is probably your best bet; pass it with idThread = 0 to get the info from the currently active thread, and then check the rcCaret member of the returned GUITHREADINFO structure. You'll then need to use ClientToScreen() with the hwndCaret value to convert client-relative coordinates to screen coordinates. Note that this only works for apps that use the Win32 caret functions - specifically SetCaretPos(). If an app draws its own caret without using these, you may not get anything meaningful back. (Some apps, like Word, draw their own caret, but still call SetCaretPos so that accessibility aids that need to track the caret can use this technique.) The rectangle you get back can sometimes be wider than the actual caret. When a bitmap is used for the caret, as is the case for Right-To-Left or Left-To-Right carets that have a little 'flag' attached to the top, you'll get back a rectangle that's a bit wider than the actual caret area, and may need to adjust or otherwise figure out where within this area the actual caret bar is - it may or may not be in the exact middle. Looks like for Notepad++ you should be fine, though. ------------------------- -Edgar |
|
|
|
![]() |
|
If you are working in Dragon-compatible applications (Word, Outlook, a browser with its Dragon plug-in installed), there are easier and faster ways to select text. Moving the mouse pointer, clicking, and dragging is a lot of work because you're dealing with content on the level of the pixel - and there are millions of pixels. The following technique uses the words that you can see as anchors.
The main technique is this: "select [word]" For example, if you want to select the last word in the first paragraph, say: "select anchors" If you want to select the last word in the first paragraph and the punctuation mark afterward, say: "select anchors period" To select the first four words in the first paragraph, say: "select if you are working" When selecting big chunks of text, specify the start and end words. To select from the start of the first paragraph to after "faster," say: "select if through faster" (Depending on your region, you may need to substitute the word "to" for "through" when selecting a range of text.) |
|
|
|
![]() |
|
This is an AutoHotKey FAQ. Here is my Dragon - AHK code to do it. I hope this provides enough information that you could translate it into Dragon Basic.
#TBD-post-to-my-GitHub-wiki
It does not work with all apps. For example, I print warning or explanatory messages because I already know it does not work in Microsoft OneNote or Google Chrome. It works in Outlook and Microsoft Word. It gets confused on some systems, like my system that has 4 monitors, each with different display scaling. That's a generic AutoHotKey problem AFAICT. But it works in quite a few places, enough to be useful. I currently have it as a single global binding, with the explanatory messages for places where it is known to be bad. You might prefer to only enable it in apps that you know it works.But that leads to a proliferation of app specific commands in Dragon Basic.
;; HERE: move mouse to text positiom ;; I don't really need move text position to mouse, because that's usually just a plain click ;; although I suppose I could have a command like that global.simple( { action_fn: Func("fn_move_Mouse_to_Text_cursor") , regex: "(move[d]? )?mouse( (cursor|pointer|position))?( to)? text (cursor|caret|\^|position)" , 0:0 } ) ;; TBD: automate the tests, embedding them in the pattern ;; "Comment: relatively complete basic patterns" ;; { test_pattern: "PUFF move mouse cursor to text cursor" } ;; { test_pattern: "PUFF move mouse cursor to text caret" } ;; { test_pattern: "PUFF move mouse to text cursor" } ;; { test_pattern: "PUFF move mouse to text caret" } ;; { test_pattern: "PUFF mouse cursor to text cursor" } ;; { test_pattern: "PUFF mouse cursor to text caret" } ;; { test_pattern: "PUFF mouse to text cursor" } ; ;; { test_pattern: "PUFF mouse to text caret" } ;; { test_pattern: "PUFF mouse to text position" } ;; { test_pattern: "PUFF move to text cursor" } ;; { test_pattern: "PUFF move to text caret" } ;; { test_pattern: "PUFF move to text position" } ;; { test_pattern: "PUFF move mouse cursor to caret" } ;; { test_pattern: "PUFF move mouse to caret" } ;; { test_pattern: "PUFF move mouse to text cursor position" } ;; { test_pattern: "PUFF move mouse to text caret position" } ;; "Comment: special case?" ;; { test_pattern: "PUFF move to caret" } ;; "comment: misrecognitions kluged in" ;; { test_pattern: "PUFF moved to caret" } ;; "comment: end" ) ;; TBD: It might be nice to have this as a mouse trackball hotkey finding, in addition to speech fn_move_Mouse_to_Text_cursor(args,tuple) { local if(1) { CoordMode, Caret, Screen CoordMode, Mouse, Screen MouseGetPos,old_X,old_Y MouseMove, %A_CaretX%, %A_CaretY% MouseGetPos,new_X,new_Y mouse_moved := old_X != new_X || old_Y != new_Y same_mc := new_X == A_CaretX && new_Y == A_CaretY if( mouse_moved ) my_ExitApp(0) if( same_mc ) my_ExitApp(0) ;; TBD: use some sort of heuristic or fuzz since seldom is the mouse exactly equal to the ^, there is often an offset if(1) { known_problem := "" if( my_WinActive("OneNote") ) known_problem := "`nactive app OneNote is known problem" if( my_WinActive("Chrome") ) known_problem := "`nactive app Chrome is known problem" msg_short := "Mouse did not move. App may not support A_CaretXY text position. " . known_problem msg_long := "" . "Mouse did not move - active window/app may not support A_CaretXY" . "`n Apps known to support: emacs, word,.." . "`n Apps known to NOT support: OneNote, Chrome, ..." . known_problem my_error(msg_short,msg_long) my_ExitApp(1) } } my_ExitApp(0) ;; fall through my_error("command not recognized: " . args . "`n only handled in " . contexts ) } ------------------------- DPG15.6 (also DPI 15.3) + KB, Sennheiser MB Pro 1 UC ML, BTD 800 dongle, Windows 10 Pro, MS Surface Book 3, Intel Core i7-1065G7 CPU @ 1.3/1.5GHz (4 cores, 8 logical, GPU=NVIDIA Quadro RTX 3000 with Max-Q Design. |
|
|
|
![]() |
|
BTW I have since updated to use my "MouseMove_KLUGE", and it does a better job of handling displays with heterogenous display scaling ------------------------- DPG15.6 (also DPI 15.3) + KB, Sennheiser MB Pro 1 UC ML, BTD 800 dongle, Windows 10 Pro, MS Surface Book 3, Intel Core i7-1065G7 CPU @ 1.3/1.5GHz (4 cores, 8 logical, GPU=NVIDIA Quadro RTX 3000 with Max-Q Design. |
|
|
|
![]() |
|
I'm not sure what your using and why. It sounds like a text edit. Don't know what SP WinPress is. I'm using Office 365 DeskTop OneNote. I have 2 items on my ToolBar that I use to recover my previous locations.
Bob ------------------------- Robert Snow |
|
|
|
![]() |
|
Irene does not mean speech friendly office applications. There are more than enough ways there to get to the insertion point there and using a mouse would be mostly unnecessary (both SP versions have several really fast text direction commands). However, her issue is particularly occurring in Google Docs, which is probably the most Dragon® unfriendly application right next to Thunderbird.
Moving the mouse pointer to the current insertion point (regardless of which application you are in) has been a long-term wish for many Dragon users, including myself.
However this involves a complex process, not even sure if it's doable in a way that it reliably works everywhere. Nevertheless, this has my full attention and I'm going to ask Tom to take a serious look at creating a simple utility for this that doesn't require complex coding for the user.
@Robert Snow The WinPress command Irene is referring to is part of the SP Press Utility© (available in both SP Standard and PRO):
------------------------- Turbocharge your Dragon productivity with 40+ Power Addons |
|
|
|
![]() |
|
I just whipped up this custom Dragon command to select text in non-Dragon friendly applications. It's not bulletproof. But hopefully it's a good place to start.
Grab <direction> <1-12> <move-by-unit> Sub Main ' Select text in non-Dragon friendly applications. Examples: ' "Grab Right 2 Words" ' "Grab Down 5 Lines" ' "Grab Up 8 Paragraphs" ' "Grab Left 12 Characters" ' OK to substitute "Cares" for "Characters" and "Paras" for "Paragraphs" Dim Direction, Count, Unit As String Let Direction = ListVar1 ' down, left, right, or up Let Count = ListVar2 ' Number of repetitions Let Unit = Left(ListVar3, InStr(ListVar3, "\")-1) ' SendKey codes to select words, lines, characters, paragraphs, etc. SendKeys Unit & "{" & Direction & " " & Count & "}" ' Example: SendKeys "+^{Right 5}" End Sub You'll need to create three lists in the Command Browser: <direction> consists of: down left right up <1-12> consists of: 1 2 3 4 5 6 7 8 9 10 11 12 You can expand this list to 20, 50, 100, or whatever maximum value seems reasonable to you. <move-by-unit> consists of: +\Care +\Cares +\Character +\Characters +\Line +\Lines +^\Para +^\Paragraph +^\Paragraphs +^\Paras +^\Word +^\Words This list contains the codes for SendKeys to output either the Shift key, or the Shift key plus the Ctrl key. |
|
|
|
![]() |
|
Thank you very much, Allan, for some reason I only tried this out now, and it does help in selecting text in Google Docs. Thank you for taking the time to create this script for me.
|
|
|
FuseTalk Standard Edition v4.0 - © 1999-2023 FuseTalk™ Inc. All rights reserved.