Date 1 - 2 of 2
select a certain number of characters
|1 - 2 of 2|
is it possible to select a certain number of characters starting from a certain offset without emulating shift+arrows? if it is, I guess it is something related to text infos, but no idea how...
Stefan Moisei via groups.io, il 22/1/2023, ha scritto:
is it possible to select a certain number of characters starting from a certain offset without emulating shift+arrows? if it is, I guess it is something related to text infos, but no idea how...Alberto:
it could depend from specific TextInfo implementation used, but try this:
1. open a document, i.e. with Notepad;
2. write something, i.e. "This is a test";
3. open NVDA Python console;
4. write these instructions, looking at each result:
# get TextInfo object at cursor position
# expand to include the first character
# move the end to include other 3 characters
info.move(textInfos.UNIT_CHARACTER, 3, "end")
# see what info covers
# and select in editor window
Note that POSITION_CARET could be not supported... and you can define info pointing it to a specific (start, end) position, instead of creating, expanding and moving; like this:
from textInfos.offsets import Offsets
Even if it doesn't work with UIA, at least as far as I know.
Anyway, PlaceMarkers add-on is a good reference for this kind of stuff.
|1 - 2 of 2|