You are a beuatiful person! That worked perfectly!
Here is my final code (for anyone who later wants to use this):
main();
function main() {
var myDialog = app.dialogs.add({name: "Search for the user submitted text and remove hyperlinks from found items.", canCancel: true});
with(myDialog) {
with(dialogColumns.add()) {
with(borderPanels.add()) {
staticTexts.add({staticLabel: "Search and remove hyperlinks for:"});
var myTextBox = textEditboxes.add({minWidth:200});
}
}
}
if (myDialog.show() == true) {
var myDocument = app.activeDocument,
noneStyle = myDocument.characterStyles.item(0),
myHyp = myDocument.hyperlinks.everyItem().getElements(),
len = myHyp.length,
myFindVal = myTextBox.editContents,
myCount = 0;
while (len-->0)
if (myHyp[len].source.hasOwnProperty("sourceText") && myHyp[len].source.sourceText.contents == myFindVal) {
myHyp[len].source.sourceText.appliedCharacterStyle = noneStyle;
myHyp[len].source.sourceText.clearOverrides(OverrideType.ALL);
myHyp[len].remove();
myCount++;
}
alert("Done! Part hyperlinks have been removed for: '" + myFindVal + "'! (Hyperlinks removed: " + myCount + ")");
}
myDialog.destroy();
}