Hey there, I've been wandering around the barren land of documentation for a while now, thought I'd try my hand at asking for help.
I'm trying to get the selected / highlighted text when using the text tool.
I've stumbled across / figured out a lot of the other aspects i need, but I haven't yet figured out how to get the actual selection start and end (text range).
Using the Action Manager / Description world I can iterate over the textStyleRanges, but I don't know how to tell which one is currently highlighted.. I see the 'from' and 'to' of each range, but that's it.
Get Currently Selected / Highlghted Text
-
- Posts: 3
- Joined: Mon Jan 14, 2019 3:49 am
Re: Get Currently Selected / Highlghted Text
From the lack of responses and also through my own investigation, I'm thinking this is not possible.
Using the script listener, I see that the changes to the TextItem's From and To properties are passed raw values, not fetched by using an ActionDescriptor:
var idFrom = charIDToTypeID( "From" );
desc169.putInteger( idFrom, 28 );
var idT = charIDToTypeID( "T " );
desc169.putInteger( idT, 40 );
I'd expect the 28 and 40 above to be retrieved in some way if this was possible. 28 and 40 represent the beginning and end of a text range. Essentially, the highlighted section in the screenshot to my last post.
Unless someone knows some way to do it and is willing to speak up, I figured I would leave another post to help anyone reach my conclusion a couple days sooner.
Using the script listener, I see that the changes to the TextItem's From and To properties are passed raw values, not fetched by using an ActionDescriptor:
var idFrom = charIDToTypeID( "From" );
desc169.putInteger( idFrom, 28 );
var idT = charIDToTypeID( "T " );
desc169.putInteger( idT, 40 );
I'd expect the 28 and 40 above to be retrieved in some way if this was possible. 28 and 40 represent the beginning and end of a text range. Essentially, the highlighted section in the screenshot to my last post.
Unless someone knows some way to do it and is willing to speak up, I figured I would leave another post to help anyone reach my conclusion a couple days sooner.
Re: Get Currently Selected / Highlghted Text
That's not possible as highlighted text make Photoshop waits to commit 'changes' even if you only highlighted text, but didn't start to edit it. Only way to do what you want is to involve external application wrote by for ex. autohotky.com if you are on Windows, are you?
-
- Posts: 3
- Joined: Mon Jan 14, 2019 3:49 am
Re: Get Currently Selected / Highlghted Text
Hey Kukurykus , thanks for the response. I am on windows.
i noticed there was the "commit" phase for text changes, as well.
When you say:
i noticed there was the "commit" phase for text changes, as well.
When you say:
is this a standard practice for plugin authors?Only way to do what you want is to involve external application
Re: Get Currently Selected / Highlghted Text
No, it's not, and it would work for Windows only if you used AHK I mentioned in previous post.