Help to open a link in calibre program window

Get help with using AutoHotkey and its commands and hotkeys
Maxsteinfeld
Posts: 24
Joined: 25 Jun 2017, 02:18

Help to open a link in calibre program window

15 Jul 2017, 04:59

Hi,
I would like to automate the conversion process of e-books with"calibre"-
To do this, I have to open a certain link ("click to open") in the calibre window
but this link-position is always located at different places in according to which
book is converted - to open the link with a "x y pos (mouse) click" is impossible (or is it ?)
The general question is "how to open a link in an open window"
greets
Max
User avatar
Delta Pythagorean
Posts: 103
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the 8th Dimension I think...

Re: Help to open a link in calibre program window

15 Jul 2017, 05:17

You can always use ControlClick
vDelPy := RegExReplace("Delta Pythagorean", "^(\w{3})\w*\s+\b(\w{2})\w*$", "v$1 $2")
"I know that reference!"
Maxsteinfeld
Posts: 24
Joined: 25 Jun 2017, 02:18

Re: Help to open a link in calibre program window

15 Jul 2017, 07:13

hi
Thx for the hint -
ok - that's a idea to use "controlClick"
i try simply

Controlclick ,click to open,calibre,,,
or
Controlclick ,ahk_class Qt5QWindowIcon, calibre,,,

but nothing happend
what are the correct parameters ?

if i add a correct position x1225 y606 for a marked book ControlClick works:
ControlClick ,x1225 y606, calibre,,,, NA
the link will be open !

but if I mark now an other book, the position of the "click to open" - link is at an other position ?? :headwall:
thats the prob !
Max
Maxsteinfeld
Posts: 24
Joined: 25 Jun 2017, 02:18

Re: Help to open a link in calibre program window

16 Jul 2017, 11:31

Delta Pythagorean wrote:You can always use ControlClick


Hi Delta
Could you pls help me in the use of "ControlClick" to solve my prob ?
Thx
Max
User avatar
Delta Pythagorean
Posts: 103
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the 8th Dimension I think...

Re: Help to open a link in calibre program window

16 Jul 2017, 18:25

ControlClick works off of the following parameters:

Code: [Select all] [Download] GeSHi © Codebox Plus

ControlClick [, Control-or-Pos, WinTitle, WinText, WhichButton, ClickCount, Options, ExcludeTitle, ExcludeText]

Control is the ClassNN that displays.
Run an AutoHotkey Script and right click the tray icon and then click window spy. Wait for it to run, open the program that has what you want, then hover over the item you want to click.
It should display the ClassNN.
Next, the WinTitle, this will allow you to click on the control in the window you want. WinText is unneeded in this problem and so is WhichButton, ClickCount, Options, ExcludeTitle, and ExcludeText.
I hope this helps.
vDelPy := RegExReplace("Delta Pythagorean", "^(\w{3})\w*\s+\b(\w{2})\w*$", "v$1 $2")
"I know that reference!"
Maxsteinfeld
Posts: 24
Joined: 25 Jun 2017, 02:18

Re: Help to open a link in calibre program window

17 Jul 2017, 05:29

Delta Pythagorean wrote:ControlClick works off of the following parameters:

Code: [Select all] [Download] GeSHi © Codebox Plus

ControlClick [, Control-or-Pos, WinTitle, WinText, WhichButton, ClickCount, Options, ExcludeTitle, ExcludeText]

Control is the ClassNN that displays.
Run an AutoHotkey Script and right click the tray icon and then click window spy. Wait for it to run, open the program that has what you want, then hover over the item you want to click.
It should display the ClassNN.

Hi Delta
thx again - I have used "window spy" and hover over the item "Click to open" but I do not get usable results:
in "Control under Mouse Position" window spy generates "ClassNN: Text calibre - || Calibre-Bibliothek ||"
that is the same Information as in "Window Title" - so I get no specified access to the desired link "click to open"
Is there another way to access the link?
see pick for explantion
Image
greets
Max
User avatar
Delta Pythagorean
Posts: 103
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the 8th Dimension I think...

Re: Help to open a link in calibre program window

17 Jul 2017, 05:43

Are you able to highlight the text, "Click to Open"?
vDelPy := RegExReplace("Delta Pythagorean", "^(\w{3})\w*\s+\b(\w{2})\w*$", "v$1 $2")
"I know that reference!"
Maxsteinfeld
Posts: 24
Joined: 25 Jun 2017, 02:18

Re: Help to open a link in calibre program window

17 Jul 2017, 07:19

Delta Pythagorean wrote:Are you able to highlight the text, "Click to Open"?

yes - when i hover via the text (link) "Click to open" the text color changes from "blue" to "red"
Window Spy:
Control Under Mouse Positin\ClassNN\Text: no changes
Control Under Mouse Positin\ClassNN\Color: changes
KeypressGuy

Re: Help to open a link in calibre program window

17 Jul 2017, 16:54

You could send ^f then the name of the book to find it.
Then you could right-click on the colored highlight of the matching book.
Then you could send six {down}s a {right} and an {enter} to kick off the conversion.

(Your keypresses may differ, depending on what version of Calibre you are using.
User avatar
Delta Pythagorean
Posts: 103
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the 8th Dimension I think...

Re: Help to open a link in calibre program window

17 Jul 2017, 16:57

No, I mean select the text as if it was able to be edited like a message here.
vDelPy := RegExReplace("Delta Pythagorean", "^(\w{3})\w*\s+\b(\w{2})\w*$", "v$1 $2")
"I know that reference!"
Maxsteinfeld
Posts: 24
Joined: 25 Jun 2017, 02:18

Re: Help to open a link in calibre program window

18 Jul 2017, 01:29

Delta Pythagorean wrote:No, I mean select the text as if it was able to be edited like a message here.

Hi Delta,
sorry - small misunderstanding
yes I can highlight the line "click to open"
see:

Image
best regards
Max
User avatar
Delta Pythagorean
Posts: 103
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the 8th Dimension I think...

Re: Help to open a link in calibre program window

18 Jul 2017, 02:19

Is it always on the left or right side of the Gui? Because that might help immensely.
vDelPy := RegExReplace("Delta Pythagorean", "^(\w{3})\w*\s+\b(\w{2})\w*$", "v$1 $2")
"I know that reference!"
Maxsteinfeld
Posts: 24
Joined: 25 Jun 2017, 02:18

Re: Help to open a link in calibre program window

18 Jul 2017, 02:39

Delta Pythagorean wrote:Is it always on the left or right side of the Gui? Because that might help immensely.

"click to open" is always on the right side of the Gui
but the position differs
User avatar
Delta Pythagorean
Posts: 103
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the 8th Dimension I think...

Re: Help to open a link in calibre program window

18 Jul 2017, 03:10

Differs how?
Show a screenshot of the full Gui. I'm not getting much information.

Also, is it in the same position "X"-wise?
vDelPy := RegExReplace("Delta Pythagorean", "^(\w{3})\w*\s+\b(\w{2})\w*$", "v$1 $2")
"I know that reference!"
Maxsteinfeld
Posts: 24
Joined: 25 Jun 2017, 02:18

Re: Help to open a link in calibre program window

18 Jul 2017, 03:45

Delta Pythagorean wrote:Differs how?
Show a screenshot of the full Gui. I'm not getting much information.

Also, is it in the same position "X"-wise?


ok
here is a picture showing 2 screenshots of the Gui's of 2 diffrent books:
Image
as you see: the position of "click to open" is located at different positions
how can i hit "click to open" and open it ?
Max
User avatar
Delta Pythagorean
Posts: 103
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the 8th Dimension I think...

Re: Help to open a link in calibre program window

18 Jul 2017, 03:48

I'm sorry but I can't think of any possible way.
Sorry.
vDelPy := RegExReplace("Delta Pythagorean", "^(\w{3})\w*\s+\b(\w{2})\w*$", "v$1 $2")
"I know that reference!"
Maxsteinfeld
Posts: 24
Joined: 25 Jun 2017, 02:18

Re: Help to open a link in calibre program window

18 Jul 2017, 03:56

Hi Delta
OK
Thank you for your help - I thought so
greets
Max
KeypressGuy
Posts: 5
Joined: 17 Jul 2017, 16:55

Re: Help to open a link in calibre program window

18 Jul 2017, 10:01

You could use the mouse cursor to find the link:
Point the mouse to a spot on the screen just above "Jobs 0". Then in a loop, slowly, with small SLEEP delays, move the mouse up 3 pixels at a time until the cursor becomes the pointing hand. At that time it must be pointing at Click to open, so then you send a click.
Maxsteinfeld
Posts: 24
Joined: 25 Jun 2017, 02:18

Re: Help to open a link in calibre program window

18 Jul 2017, 11:23

KeypressGuy wrote:You could use the mouse cursor to find the link:
Point the mouse to a spot on the screen just above "Jobs 0". Then in a loop, slowly, with small SLEEP delays, move the mouse up 3 pixels at a time until the cursor becomes the pointing hand. At that time it must be pointing at Click to open, so then you send a click.


Ok i understand your "radar "- solution - very nice :bravo:
but when "the cursor becomes the pointing hand (== meeting the link 'click to open')" what is the AHK command in my script to detect this and send a "click" ?
Max
KeypressGuy
Posts: 5
Joined: 17 Jul 2017, 16:55

Re: Help to open a link in calibre program window

18 Jul 2017, 11:47

The variable A_Cursor will (probably) be "Arrow" until it becomes a hand, at which point it becomes "Unknown".

The BREAK will break out of the loop. Then past the end of the loop, you issue a click command with no parameters because, presumably, the mouse is already pointing right at the link.
With this kind of mouse cursor loop it is easy to overshoot the mark. Just keep increasing the SLEEP until the motion is slow enough that it always triggers the logic.
For protection, you could also use MouseGetPos to check the actual mouse cursor position and kill the process if the mouse pointer gets near the top of the window (A low OutputVarY value).

Return to “Ask For Help”

Who is online

Users browsing this forum: eekhelpspike, Yahoo [Bot] and 23 guests