Copy link to clipboard
Copied
Does anyone have a script that turns off the smart text flow preference? I'd like to apply the script when the document is opened.
Thanks
Hi @Davis_XI, you must specify a target engine for these event listeners to work. In VSCode a target engine directive should begin with "//@targetengine". Try this exact code:
//@targetengine "smartText";
app.addEventListener("afterOpen", changeSmartText);
// alert('New "afterOpen" event listener is active.');
function changeSmartText(e) {
if (e.parent.constructor.name == "LayoutWindow") {
e.parent.parent.textPreferences.smartTextReflow = false;
alert('Smart Text Reflow = '
...
It's still not working after i moved it to the startup scripts folder.
Did you restart InDesign? Try adding an alert to test the listener, and include the targetengine line. Change to this and restart after you add it to the startup folder:
#targetengine "smartText";
app.addEventListener("afterOpen", changeSmartText);
function changeSmartText(e) {
if (e.parent.constructor.name == "LayoutWindow") {
e.parent.parent.textPreferences.smartTextReflow = false;
alert("This docu
...
Copy link to clipboard
Copied
Hi @Davis_XI, this little script should turn it off. - Mark
var doc = app.activeDocument;
doc.textPreferences.smartTextReflow = false;
alert('Smart Text Reflow = ' + doc.textPreferences.smartTextReflow);
Copy link to clipboard
Copied
Hi @Davis_XI , do you want it to happen automatically every time any document is opened? In that case it would have to be a startup script that listens for an open event.
Copy link to clipboard
Copied
Hi Rob, in a perfect world that is how it would work. I've been looking into how to create an open event.
Copy link to clipboard
Copied
You could run this from your scripts panel, and any document you open while ID is running would have the preference set. Or you can put it in your startup scripts folder and it will always run on a startup:
#targetengine "smartText";
app.addEventListener("afterOpen", changeSmartText);
function changeSmartText(e) {
if (e.parent.constructor.name == "LayoutWindow") {
e.parent.parent.textPreferences.smartTextReflow = false;
}
};
Copy link to clipboard
Copied
Hi Rob, thanks but I can't seem to get it to work. So far I've only tried running it with a document open. Is it referencing the previous script or will it work by itself? Really sorry for asking stupid questions ☺️
Copy link to clipboard
Copied
It’s listening for an open event, so it wouldn’t affect a document that is already open.
Does it work if you close then reopen the document?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi @Davis_XI, you must specify a target engine for these event listeners to work. In VSCode a target engine directive should begin with "//@targetengine". Try this exact code:
//@targetengine "smartText";
app.addEventListener("afterOpen", changeSmartText);
// alert('New "afterOpen" event listener is active.');
function changeSmartText(e) {
if (e.parent.constructor.name == "LayoutWindow") {
e.parent.parent.textPreferences.smartTextReflow = false;
alert('Smart Text Reflow = ' + e.parent.parent.textPreferences.smartTextReflow);
}
};
- Mark
Copy link to clipboard
Copied
It's still not working after i moved it to the startup scripts folder.
Did you restart InDesign? Try adding an alert to test the listener, and include the targetengine line. Change to this and restart after you add it to the startup folder:
#targetengine "smartText";
app.addEventListener("afterOpen", changeSmartText);
function changeSmartText(e) {
if (e.parent.constructor.name == "LayoutWindow") {
e.parent.parent.textPreferences.smartTextReflow = false;
alert("This document's Smart Text Reflow has been set to: " + e.parent.parent.textPreferences.smartTextReflow)
}
};
I get this everytime I open a document:
Copy link to clipboard
Copied
Perfect. Once again, thank you for your patience.