Thanks for your answer. The thing is that I already have a script which runs all of these Find/Change GREPS in order to format my very long incoming Word documents into the desired format in InDesign, so I just want to add searching and formatting underlined text to my script.
It's as straightforward as this:
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing; app.findTextPreferences.underline = true; app.changeTextPreferences.appliedCharacterStyle = app.activeDocument.characterStyles.item("italic"); app.changeTextPreferences.underline = false; app.activeDocument.changeText();
unless it needs deep integration into your current script.
Scripting related questions can better be asked in the Scripting forum: InDesign Scripting
Brilliant, thank you so much.