Copy link to clipboard
Copied
Hey folks,
I'm thinking of writing a script to add local LLM api support to FrameMaker. I basically want to get AI assisted proofreading/text correction by doing the following (using a local lightweight Mistral-7B model):
1. Select text, then send it via button press to an LLM client running on my computer (LM Studio or ollama) for proofreading
2. Receive & process the proofreading results
3. Apply the suggestions to the text in FrameMaker
Before I dive into what might just be an impossible task due to ExtendScript limitations (I'd have to do quite a lot of digging, I'm not a real coder), do you think this is doable? I'd be very grateful for any insights, or tips where to start. 🙂🙏
I gave you a headstart with this post:
https://community.adobe.com/t5/framemaker-discussions/get-framemaker-text-as-a-string/td-p/14491503
You will see that I have created a function for getting text from any FrameMaker text object (TextRange, Pgf, Flow, etc.). Functions like this are useful because you can plug them into any of your scripts as needed.
// Replace the selected text.
// You already have the selection in a varable.
doc.DeleteText (textRange);
doc.AddText (textRange.beg, correctedText);
Untested, but it should work.
These two short videos will explain text locations and text ranges:
https://youtu.be/6ywYWU4VC7g?si=pA7llQ5vS8nIlqwt
https://youtu.be/fH5giAcDp6Q?si=lerkUNDTWdSoLKjO
If you are in a hurry, the second one will show you how to select a paragraph.
Copy link to clipboard
Copied
One caution with the paragraph selection code: when the selected text is replaced, any anchored objects in the selection (tables, anchored frames, markers, etc.) will be deleted.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now