Page 1 of 1
How know the coordinates of the text cursor (not mouse pointer)?
Posted: Wed Feb 03, 2021 1:55 am
by arivas_2005
Regards,
I am very curious:
I found that to know the coordinates of the mouse pointer is used
... there is a way to know the coordinates of the cursor (of text) in a window (example, in a "text field -multiline" or in a text editor (not in terminal), to know in which line or column of the text the cursor)
Thank you
Re: How know the coordinates of the text cursor (not mouse pointer)?
Posted: Thu Feb 04, 2021 1:34 am
by arivas_2005
Hello
adding a more specific detail.
Is there a way to know using a command if the cursor-text (no cursor mouse) is in position 1 or in position 2 (the coordinates in both cases)
(see Figure)
thanks
Re: How know the coordinates of the text cursor (not mouse pointer)?
Posted: Sat Feb 06, 2021 12:20 pm
by puppy_apprentice
I suppose that you want jump between fields in browser. In Firefox you can use tab key for this.
In terminal try this (if you use Chrome browser):
Code: Select all
xdotool search --class Chrome windowactivate --sync %1 key tab windowactivate $(xdotool getactivewindow)
or
Code: Select all
xdotool search --name Title of the browser window key tab
You have to run those commands as many times as you get proper field in a browser. To check how many times you have to send tab key to browser window - use tab key manually in opened page in browser.
PS. But i think that the best that you can do to automate/manipulate stuff in browser is JavaScript and HTML DOM. There was a add-on for Firefox called Greasemonkey to achieve this.
Re: How know the coordinates of the text cursor (not mouse pointer)?
Posted: Sat Feb 06, 2021 2:39 pm
by arivas_2005
Hello puppy_apprentice,
thanks for the support.
What I need to know is in which of the two boxes the text cursor is
Know if it is in the top (1) or the bottom (2).
That's my kid with this page.
The use of tab is when I already know which box the cursor is in. But before that, I must know in which textbox it is [In (1) or (2)].
Or you can't know the position of the text cursor, as does the position of the mouse pointer?
Thank you again.
Re: How know the coordinates of the text cursor (not mouse pointer)?
Posted: Sat Feb 06, 2021 3:36 pm
by puppy_apprentice
arivas_2005 wrote: Sat Feb 06, 2021 2:39 pm
Or you can't know the position of the text cursor, as does the position of the mouse pointer?
I think xdotool can't do this, especially in html documents loaded into browser. You can only send keystrokes to the app and if app doesn't have function that shows cursor position you won't get it.
You can only use JavaScript in browser to do this i think.
Re: How know the coordinates of the text cursor (not mouse pointer)?
Posted: Sun Feb 07, 2021 1:47 am
by arivas_2005
Hello puppy_apprentice,
well
thanks for the support!