Getting the definition from a book

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
madcyborg
Newbie
Posts: 12
Joined: Sun Oct 20, 2019 3:22 pm

Getting the definition from a book

Post by madcyborg » Mon Feb 07, 2022 3:21 am

I am using the Macro Scheduler "MouseButtons" executable to place some buttons at the top of my screen.
I use reading software to read books. Unfortunately, the ability to get definitions of words is not included. So what I wanted to do is be able to double-click the word and then single click on one of the mouse buttons to move that word onto the clipboard and then open up Chrome automatically with the definition.

I have tried many different ways of doing it, and now it's getting hairy as I try tab through the sub-windows to get at the window that has the highlighted word. There's got to be a better way. So far, nothing I have tried puts the word onto the clipboard. I think that's the real barrier. Any ideas? The solution must be single-click.

Code: Select all

Let>WIN_REGEX=1
SetFocus>.*Dolphin EasyReader
WaitWindowFocused>.*Dolphin EasyReader
MouseMove>500,200
LClick
Wait>1
LClick
Wait>0.203
Press CTRL
Send>c
Release CTRL
Wait>0.203
GetClipBoard>WORD,0
MessageModal>%WORD%
// RunProgram>cmd /c start chrome https://www.dictionary.com/browse/%WORD%?s=t -incognito

Neib74656
Junior Coder
Posts: 29
Joined: Fri Sep 10, 2021 10:51 pm

Re: Getting the definition from a book

Post by Neib74656 » Mon Feb 07, 2022 3:55 am

Hello Madcyborg,

I was having a similar issue to you. I found the solution to be to specify RCTRL instead of just CTRL. I also added a wait command between send>c and Release LCTRL so the computer does not try to execute both commands at exactly the same time often causing it to skip a step. Others may have a better solution but you may want to try the following.

Code: Select all

Let>WIN_REGEX=1
SetFocus>.*Dolphin EasyReader
WaitWindowFocused>.*Dolphin EasyReader
MouseMove>500,200
LClick
Wait>1
LClick
Wait>0.203
Press LCTRL
Send>c
Wait>0.05
Release LCTRL
Wait>0.203
GetClipBoard>WORD,0
MessageModal>%WORD%
// RunProgram>cmd /c start chrome https://www.dictionary.com/browse/%WORD%?s=t -incognito

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Getting the definition from a book

Post by Dorian (MJT support) » Mon Feb 07, 2022 10:01 am

Do you mean QuickButtons?

I was unsuccessful with both. It seems to me that it fails if : the word is double-clicked and then focus moves away from Dolphin Reader - even if we get focus back and the word is still highlighted. We can do this as a human, it seems, but not with Macro Scheduler.

This makes me wonder if QuickButtons is causing this because it momentarily takes focus from the Dolphin Reader. If I remove everything other than the CTRL C, and assign my macro a hotkey (I used F3 so it's a single click), it will successfully extract the word :

Code: Select all

Press CTRL
wait>0.1
Send>c
wait>0.1
Release CTRL
Wait>0.1
GetClipBoard>WORD,0
MessageModal>%WORD%
If using a keyboard hotkey is not possible for you, do you have a programmable mouse? If so, you can program one of the extra mouse buttons to execute a hotkey.
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts