could you post a screenshot of before and after running a potential script?
The text cursor should be positioned into the text.
From my limited knowledge on PhotoShop scripting:
textItem.kind == TextType.PARAGRAPHTEXT
Example for hyphenated text. noBreak is false, hyphenation is true:
If you set noBreak to true all contents will optically vanish. It's contents is still there, but in overset.
Unless you increased the width of the frame in advance so that all text fits to one line.
So setting text to noBreak = true is no good idea at all.
textItem.kind == TextType.POINTTEXT
Convert the example above to TextType.POINTTEXT.
No hyphenation exists.
Just text that perhaps looks like it is hyphenated.
Result is a dash plus a paragraph sign as substitute for the hyphen in the example above:
In this case you would convert back to TextType.PARAGRAPHTEXT and want to get rid of the faux hyphen and the paragraph sign. Increase the width of the frame that all text fits on a line.
Example after converting back to TextType.PARAGRAPHTEXT:
You cannot be sure, that a dash followed by a paragraph sign is always meant as a hyphen.
In a lot of cases, yes, but not in all cases.
See into property contents of textItem that returns a string.
You can manipulate that with a regular expression doing a string operation with method replace() and assign the new contents if you do a loop on all relevant artLayers.
layers[n].textItem.contents = layers[n].textItem.contents.replace(/-\r/g,"");
If you want to omit cases, you can do a more elaborate regular expression than the one above.
Here a link to a clever function that recursively traverses all layers and stores them in an array:
( Tested with ExtendScript on PhotoShop CS6 on Mac OSX 10.6.8. )
Pfaffenbichler's script of grabbing the sublayers did the trick. Thanks so much!