AHK script to mouselessly auto-insert highlighted terms in memoQ
Thread poster: Michael Beijer

Michael Beijer  Identity Verified
United Kingdom
Local time: 15:25
Member (2009)
Dutch to English
+ ...
May 5, 2013

In case anyone is interested, here is my latest cool AutoHotkey script for
memoQ.

Are you ever in the target segment and wish you could auto-insert a highlighted
term in the source segment, WITHOUT USING YOUR MOUSE? Well, if you have, this
script will do exactly that!

--------------------start script:
; script to automatically move your mouse pointer to the caret so you can
; double-click on a highlighted term in the source segment in order to insert it
; WITHOUT USING YOUR MOUSE. before clicking: hit Tab (to change the focus to the
; src segment), and then use the arrow keys to place the caret in/on the desired
; word.
;
; with a little help from Robert Ilbrink:
; http://superuser.com/questions/591697/move-mouse-pointer-to-caret-with-shortcut-in-win8
;
;
;
;
#Persistent
CoordMode, Caret, Screen

^#:: ; Ctrl+#
MovePosX:=A_CaretX +5 ; Adjust 5 pixels to the right of A_CaretX position
MovePosY:=A_CaretY -10 ; Adjust 10 Pixels above A_CaretY position
MouseMove, %MovePosX% , %MovePosY%

Click 2 ;double-click

Return
-----------------------end script.

Enjoy!

Michael

[Edited at 2013-05-05 23:59 GMT]


 

Michael Beijer  Identity Verified
United Kingdom
Local time: 15:25
Member (2009)
Dutch to English
+ ...
TOPIC STARTER
(deleted post) May 5, 2013

(deleted post)

[Edited at 2013-05-06 14:57 GMT]


 

Michael Beijer  Identity Verified
United Kingdom
Local time: 15:25
Member (2009)
Dutch to English
+ ...
TOPIC STARTER
AHK script: autocorrect selected, underlined term using Hunspell in memoQ May 5, 2013

Are you ever translating and wish you could automatically right-click on a misspelled, underlined word to correct it, WITHOUT HAVING TO TOUCH YOUR MOUSE? Well, you can now:

--------------------*
;move your caret to a misspelled word that is underlined and click
;this to automatically select the correct spelling (it does the
;following: moves mouse pointer to caret, right-clicks, clicks down,
;once, and enters) usually, the first option down is the correct one.

; script by Michael Beijer (Wordbook.nl)

#Persistent
CoordMode, Caret, Screen

^x:: ; Ctrl+x
MovePosX:=A_CaretX +5 ; Adjust 5 pixels to the right of A_CaretX position
MovePosY:=A_CaretY -10 ; Adjust 10 Pixels above A_CaretY position
MouseMove, %MovePosX% , %MovePosY%

SendInput {Click,Right} ; right-click
Send, {Down}{Enter} ;down arrow once and enter to select correction

Return


-------------------*

PS: I will soon be collecting all of these, and many more, and sticking them on a special website called 'AutoHotkey scripts for memoQ' or something like that. Stay tuned!

Michael

[Edited at 2013-05-05 21:19 GMT]

[Edited at 2013-05-05 21:42 GMT]


 

xxxTheAlphaSens
United Kingdom
Local time: 15:25
English to French
? May 5, 2013

Michael Beijer wrote:

Are you ever in the target segment and wish you could auto-insert a highlighted
term in the source segment, WITHOUT USING YOUR MOUSE? Well, if you have, this
script will do exactly that!


Perhaps I misunderstood the purpose of your script, but isn't it something already doable without script? I can think of at least three ways to do this without the mouse.

1/ By pressing CTRL+[the number of the hit in the results panel]

Let's say the hit I want to insert next is result #3 => I press CTRL+3

2/ By enabling the AutoPick feature (with "Recognize terms" ticked)

All I need to do is press CTRL to display the dropdown list of TB hits (and co), and use up/down and Enter to insert the relevant hit.

3/ By enabling the Predictive Typing feature (with a threshold of "1")

As soon as I type the first letter of my hit, it will suggest the entire text of the hit, I can then press Enter to insert it (the first letter of the target, not the source, obviously).


 

Michael Beijer  Identity Verified
United Kingdom
Local time: 15:25
Member (2009)
Dutch to English
+ ...
TOPIC STARTER
Hi TheAlphaSense, May 5, 2013

Yes, I think you misunderstood what I am trying to achieve.

I am aware of the three methods you mentioned, however, there are instances when these are not enough.

I work with a large main termbase with around 600,000 entries, and so my 'Translation results' windows is very full. In fact, I just counted, and my current segment yields 143 entries!

I have therefore deactivated Predictive Typing and AutoPick because they currently just get in my way as my TB is too large and messy for them to produce useful results.

So imagine I am translating a rather long segment, and so have say around 140 hits in my Translation results window. Sometimes I find it very useful to be able to just Tab + Arrow my way around a source segment and then just click my special shortcut and have certain words automatically popped into my target segment, without having to look at my Translation results window at all, and without having to use my mouse to hover over a specific word. That's how I use my script.

Michael


 

Samuel Murray  Identity Verified
Netherlands
Local time: 16:25
Member (2006)
English to Afrikaans
+ ...
Some ideas May 6, 2013

Michael Beijer wrote:
;move your caret to a misspelled word that is underlined and click
;this to automatically select the correct spelling (it does the
;following: moves mouse pointer to caret, right-clicks, clicks down,
;once, and enters) usually, the first option down is the correct one.


I tried to imagine how this would save you any time, but then I realised that what it saves you is not time but mouse cramp from having to make tiny little precise movements with your arm.

So, if you're sufficiently skilled at AHK, I would suggest that you rewrite the script so that it moves to the first alternative spelling in the list, and then after 1 second moves to the second option, etc, and then you can press another key to select the correct spelling. I don't use MemoQ but I imagine that pressing ENTER when the correct option is selected would cause that option to be used by MemoQ, is that right?

You would need to test this a bit better to make sure the script doesn't do funny things when there are fewer spelling suggestions than the number of times you press the down arrow.


 

Samuel Murray  Identity Verified
Netherlands
Local time: 16:25
Member (2006)
English to Afrikaans
+ ...
Inserting terms without a mouse May 6, 2013

Michael Beijer wrote:
; script to automatically move your mouse pointer to the caret so you can
; double-click on a highlighted term in the source segment in order to insert it
; WITHOUT USING YOUR MOUSE. before clicking: hit Tab (to change the focus to the
; src segment), and then use the arrow keys to place the caret in/on the desired
; word.


Firstly, you're very lucky that AHK was able to determine the position of your caret. It doesn't work in all programs.

Secondly, are you saying that there is no way in MemoQ to insert terms using only the keyboard? I myself am using a rather primitive CAT tool (WFC) and the only way that I can insert terms in WFC is using the keyboard. I press Ctrl+Alt+left or right to select the term or placeable, and then Ctrl+Alt+down to insert the term (or its translation, if it is a glossary term) at the cursor position. Can't MemoQ do that? Must you really use your mouse every time you want to insert a term???


 

xxxTheAlphaSens
United Kingdom
Local time: 15:25
English to French
I stand corrected May 6, 2013

Michael Beijer wrote:

I am aware of the three methods you mentioned, however, there are instances when these are not enough (...) I work with a large main termbase with around 600,000 entries, and so my 'Translation results' windows is very full. In fact, I just counted, and my current segment yields 143 entries!


Alright, I see exactly what you mean.
I can see how the script could be useful to some.

I'm not a great believer in the Big Papa approach when it comes to the TB, that's probably the reason why I've never encountered that problem. It's quite rare that I have more than 10 TB hits in a segment.

Samuel Murray wrote:
Secondly, are you saying that there is no way in MemoQ to insert terms using only the keyboard? (...) Can't MemoQ do that? Must you really use your mouse every time you want to insert a term???

No, there are number of ways you can insert terms without the mouse, see my post above.

[Edited at 2013-05-06 08:17 GMT]


 

Michael Beijer  Identity Verified
United Kingdom
Local time: 15:25
Member (2009)
Dutch to English
+ ...
TOPIC STARTER
further applications May 6, 2013

Samuel Murray wrote:

So, if you're sufficiently skilled at AHK, I would suggest that you rewrite the script so that it moves to the first alternative spelling in the list, and then after 1 second moves to the second option, etc, and then you can press another key to select the correct spelling. I don't use MemoQ but I imagine that pressing ENTER when the correct option is selected would cause that option to be used by MemoQ, is that right?


Very interesting. I might just try that when I have a moment.

Incidentally, I also realise that having discovered an AHK script that can automatically move my mouse pointer to my caret (in some programs), this can probably also be used for many more cool things.

I have already used it to (mouselessly):

1. auto-correct selected, underlined terms using Hunspell in memoQ, and
2. auto-insert (first) target entries from the source grid

What else can you think of? I was thinking of a script to auto-correct spelling in web browsers, e.g.

And yes, the main reason I like these scripts is because they allow me to keep my fingers on my keyboard. I would eventually like to be able to operate my entire PC, without having to leave my keyboard . . .

Michael

[Edited at 2013-05-06 13:53 GMT]


 

Michael Beijer  Identity Verified
United Kingdom
Local time: 15:25
Member (2009)
Dutch to English
+ ...
TOPIC STARTER
my scripts also automatically corrects misspelled words in MS Word! May 7, 2013

I just discovered that my script

AHK script: autocorrect selected, underlined term using Hunspell in memoQ

also works inside Microsoft Word!

Open a Word document, find a misspelled word that is underlined with a red line, move your caret into the word, and click Ctrl+X. My script will automatically select and apply the first correction in the right-click list.

Michael


 

Samuel Murray  Identity Verified
Netherlands
Local time: 16:25
Member (2006)
English to Afrikaans
+ ...
It is debatable whether this saves time, but... May 7, 2013

Michael Beijer wrote:
I just discovered that my script ... also works inside Microsoft Word!


You can make AHK (presumably) interact with the spell checking dialog in MS Word. What you can do, then, is to enable "track changes" (so that you can check the changes afterwards) and then start with an interactive spell-check in MS Word, and then let the script always accept the first spelling suggestion, until the entire spell-check is done. Then check the changes manually (they should be tracked, so they should be easy to see), reject the ones that are wrong, and accept the rest.

Whether this would be useful remains to be seen... I suspect not.


 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

AHK script to mouselessly auto-insert highlighted terms in memoQ

Advanced search






CafeTran Espresso
You've never met a CAT tool this clever!

Translate faster & easier, using a sophisticated CAT tool built by a translator / developer. Accept jobs from clients who use SDL Trados, MemoQ, Wordfast & major CAT tools. Download and start using CafeTran Espresso -- for free

More info »
WordFinder Unlimited
For clarity and excellence

WordFinder is the leading dictionary service that gives you the words you want anywhere, anytime. Access 260+ dictionaries from the world's leading dictionary publishers in virtually any device. Find the right word anywhere, anytime - online or offline.

More info »



Forums
  • All of ProZ.com
  • Term search
  • Jobs
  • Forums
  • Multiple search