@Dobygm – you can do that without scripting. Just with a GREP Search/Replace.
Even better: If your text already has a right indent tab plus an extra character at the end of the story, one can do it with a GREP Style using a character style with a special font. You can add these two characters by a GREP Search/Replace.
A GREP Style for the last two characters could be a right indent tab followed by the letter n at the end of the selection or the end of the paragraph:
AND/OR a right indent tab followed by the letter n at the end of the story:
If you now use a font like Zapf Dingbats for the formatting of the character styles that will be triggered by the GREP Styles, you'll get a square bullet that will align right. One GREP Style for the end of paragraphs, one for the end of story. Semi automatically so to say.
See a screenshot here. Left formatted without the GREP Styles, right formatted with two GREP Styles.
Style one will apply "Zapf Dingbats" together with the fillcolor red.
Style two will apply "Zapf Dingbats" together with the fillcolor green.
Thank you. simple way to solve the problem... I'm new in the script, and I have many doubts
Also thanks. I will try to combine it with another script, I think I'll make it