I am working on an action that helps the user to clean line endings of a draft.
Therefor I want the action to loop through the whole draft. At every line ending a prompt should show the text before a line ending in one text field and the text after the line ending in another text field. And the user is offered buttons to pick if the line ending actually indicates a new paragraph or not (and if not and if a hyphen is involved how to handle the latter).
The problem: The texts before and after the line endings presumably are too long to fit into the text fields. So they have to be truncated. A fixed number of characters is difficult as the font has proportional characters and so an “m” uses more space than an “i”, an “—” more than a “.”, etc. And the devices’s screen size and the user’s system wide font size setting might influence the amount of visible characters in the text field too.
So my question is if it is possible to chose which part of a too long text is visible in a text field. The second text field in my action has to show the first characters of the second line. But the first text field has to show the last characters of the first line. In short: A setting to truncate either left or right.
Bonus question: What is the difference between addTextField and addTextView, as both descriptions in the script reference say “Add a text input field to the prompt”?
Have you considered using an Advanced Preview for this sort of thing? It might give you the control you are looking for.
PS: I have been ruminating to not use a prompt with text fields at all but to loop through the draft in the editor window itself. But that would make the whole process pretty fitful. And I would not know how to keep the prompt with the option buttons (I would still work with those) from covering the part of the editor with the respective line ending.
So a multiline text view field might have enough space to display the whole text line. But if not there is no setting here either to chose which end to truncate, right?
The Advanced Preview approach of @sylumer looks very interesting but I would have to learn it first while I have worked with Prompt actions already.
By the way, this is my use case: Scans from books. OCR nowadays works really well but delivers texts with lots of line endings which you sometimes cannot tell from just text wrappings. The action should make them distinguishable and make it easy to get either proper Markdown paragraph endings with additional empty lines, or spaces for ongoing paragraphs, with either preserved or removed hyphens.