Indesign Server Script find/change based on ParagraphStyle
Hello, I am working with IDS and I need a script that allows me to change the style based on the text and the paragraph style applied. Does anyone has something working like this on IDS ? So far the script I had it's not working, and can't find a good way to solve this. When I do a search by pagrapthStyle, the script I am using just fails:
var originalParaStyle = "Style1";
var changedParaStyle = "NewStyle";
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
if (findWhat) app.findTextPreferences.findWhat = findWhat;
if (changeTo) app.changeTextPreferences.changeTo = changeTo;
app.findTextPreferences.appliedParagraphStyle = originalParaStyle;
app.changeTextPreferences.appliedParagraphStyle = changedParaStyle;
if (findChrStyle) app.findTextPreferences.appliedCharacterStyle = findChrStyle;
if (changeChrStyle) app.changeTextPreferences.appliedCharacterStyle = changeChrStyle;
doc.changeText();The part where it fails it's when I set the appliedParagraphStyle. If the property is set empty, the script works, but with other value it just make IDS to reboot. I have tried setting is as String and ParagraphStyle path, but doesn't work.
If anyone has a working script for IDS that let's you change the ParagraphStyle of a text, of has any idea on how to overcome this, it would be really helpful.
Thanks!
