Tuesday, July 27, 2021

An AutoHotkey solution to a memoQ problem

The memoQ problem…

Some installations of memoQ suffer an annoying problem: cut and paste doesn’t work. The rest of the program works, as does copy and paste, but not the "paste" part of cut and paste: memoQ deletes your text at Ctrl+X all right, but it does not save it to the clipboard, so you have nothing to paste when you hit Ctrl+V.

If you try to perform the operation via the context menu, no luck, either: after Ctrl+X, paste (Ctrl+V) is greyed out.

Cut and Paste not working in memoQ

The problem appears unpredictably: you could have (as I do) two similar computers, with a similar panoply of software installed. On one cut and paste works as expected in memoQ, while in the other it doesn't.

memoQ’s support staff are aware of this problem, but (since they have never been able to reproduce it) their developers are unable to fix it. memoQ's support offer several suggestions that sometime work, from disabling other programs that might interfere with the clipboard, to deleting certain temporary files, and finally to that old favorite of all support organizations: reinstalling the program… but even reinstallation, for certain users, fails to correct the problem.

Fortunately, there is a simple workaround: instead of hitting Ctrl+X to cut and Ctrl+V to paste, you can add a step—copy (Ctrl+C), delete (Del), and finally paste (Ctrl+V)—but if you are accustomed to just using Ctrl+X/Ctrl+V in all other programs, you are likely to forget that you have to use different steps in memoQ.

...and the AutoHotkey solution

So we need a more permanent solution, and one is at hand (this also is thanks to a suggestion from memoQ support): using an AutoHotkey1 script to replace the “cut” part of cut and paste.

Here is the script (complete with comments to explain what each step does):

#NoEnv  		; Recommended for performance and compatibility with future 
                        ; AutoHotkey releases.
SendMode Input  	; Recommended for new scripts due to its superior speed 
                        ; and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
^x:: 			; Assigns to the Ctrl+X shortcut the following actions:
#IfWinActive memoQ 	; ensures script works with memoQ only, not with other programs
Send ^c 		; Copy (as if "Ctrl+C" had been pressed)
Send {del} 		; Delete (as if the "Delete" key had been pressed)
#IfWinActive 		; end of the "works in memoQ only" part of the script
Return 			; end of the script

You can use this script "as is" if you already have AutoHotkey installed: just copy the above code to an empty text file and save it with an .ahk extension; then, whenever you need to work in memoQ, double click on the script file to launch it.

If you use other AutoHotkey scripts, you also can add the above code snippet to one of your other scripts (so long as none of them tries uses Ctrl+X as a hotkey). And you can even compile the script to an independent .exe file, to use on computers where AutoHotkey is not installed.

 


1 AutoHotkey is a free, open-source scripting language for Windows that allows users to easily create small to complex scripts.

No comments:

Post a Comment

Thank you for your comment!

Unfortunately, comment spam has grown to the point that all comments need to be moderated. All legitimate comments will be published as soon as possible.