KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: How to remember mouse position and return to it?
Topic Summary:
Created On: 01/05/2018 06:04 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 How to remember mouse position and return to it?   - avkatz - 01/05/2018 06:04 PM  
 How to remember mouse position and return to it?   - Lunis Orcutt - 01/05/2018 06:34 PM  
 How to remember mouse position and return to it?   - avkatz - 01/05/2018 06:53 PM  
 How to remember mouse position and return to it?   - avkatz - 01/05/2018 06:57 PM  
 How to remember mouse position and return to it?   - Grindcore - 01/05/2018 10:26 PM  
 How to remember mouse position and return to it?   - avkatz - 01/06/2018 10:02 AM  
 How to remember mouse position and return to it?   - Mark Bennett - 06/01/2018 04:51 PM  
 How to remember mouse position and return to it?   - Mphillipson - 06/03/2018 03:46 PM  
 How to remember mouse position and return to it?   - Ag - 09/07/2019 03:50 PM  
 How to remember mouse position and return to it?   - kkkwj - 12/23/2020 10:49 PM  
Keyword
 09/07/2019 03:50 PM
User is offline View Users Profile Print this message

Author Icon
Ag
Top-Tier Member

Posts: 644
Joined: 07/08/2019

Ouch!

 

To persist a value between commands requires using an external database or a text file or the clipboard?

 

Here's how you do it in auto hotkey: two "commands" (hotkeys) defined by the same AHK file (actually instance, since an AHK instance can be spread across multiple files, and threads for that matter) share memory state.

 

CoordMode, Mouse, screen ; relative to screen not window
return

^!s::
mousegetpos,x,y
return

^!d::
mousemove,%x%,%y%
return

 

Save/restoring to the clipboard is not very useful for the reason I want this operation: the whole point is I want to jump back to a webpage, do some navigation and clip an item (like the micro USB cables I'm shopping for right now), jump back to my OneNote and paste the item, and continue. External database or text file will work, but it seems pretty darned heavyweight and probably slow.

 

 

In full detail

 

The AHK script Save-Restore-Mouse-Position.ahk

 

CoordMode, Mouse, screen ; relative to screen not window
return

;; Nice in itself for AHK
;; but especially useful when a Dragon speech command is bound to this
;; "Remember Mouse Position"
;; "Swap Mouse Position"

;; NOTE: the hack to do mousemove on a multi monitor system

^!+.::
   mousegetpos,saved_x,saved_y
   return

 

^!+,::
   mousegetpos,current_x,current_y
   ;mousemove,%saved_x%,%saved_y%
   ; https://www.autohotkey.com/docs/commands/MouseMove.htm
   ; the following is an alternate way to move the mouse cursor
   ;that may work better in certain multi-monitor configurations:

   DllCall("SetCursorPos", "int", saved_x, "int", saved_y)

   saved_x:=current_x
   saved_y:=current_y

   return

With Dragon commands 

Save Mouse Position ==> sending Ctrl+Shift+Alt period
Swap Mouse Position ==> sending Ctrl+Shift+Alt comma

 

It is unfortunate that Dragon SendKeys and AHK use different syntax, e.g. % vs ! for Alt.

 

 

I find this pattern of defining the basic function in AutoHotKey, with key bindings that Dragon/KnowBrainer can tickle, quite useful.  Partly because AHK's scripting language, although clumsy, seems more capable than Dragon/KnowBrainers.  But also because I often want to have keyboard shortcuts as well as voice shortcuts - I can still type, I just want to reduce the stress on my sore wrist/arm.

 

 

The biggest problem is that speech has high valency - you can have a very large number of commands - whereas hotkeys are much more limited. On Windows and MacOS, to the various combinations of modifiers and single keys.  I have previously created emacs-style menu systems for AHK, so that arbitrary length key sequences can be used to access AHK commands. I will look into automating so that Dragon/KnowBrainer commands can drive them.

 

 



-------------------------

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.



Statistics
32133 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 2 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 412 guests browsing this forum, which makes a total of 414 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2021 FuseTalk™ Inc. All rights reserved.