[js/cs4] diff'ing texts
I would like to use Extendscript to compare two texts (e.g. from two text frames) and display the differences to the user in a sensible format. I don't care about the text formatting, whitespace and such changes.
My current approach is to:
1) Fetch the contents from the two text frames.
2) Compare the contents using a javascript I found on the Internet ("jsdiff.js")
3) Save the result into a local html work file along with a wee bit of html decoration.
4) Open the file using the execute method, thus displaying the result in a web browser.
It works decently, but I would still prefer a more elegant and integrated approach. Could be that someone in this forum has a better approach...
For instance, is there any of the inDesign UI or ScriptUI widgets that will render html properly (I couldn't spot it)?
Another approach would have been to generate pdfs with the texts and use BridgeTalk to open them in Acrobats "Compare documents" window. However, you seem to have very limited control over this function.
Any suggestions would be appreciated.
Thanks,
- Peder