Copy link to clipboard
Copied
Hi,
I have to left allign hundreds of symbols - Are these below settings achievable in a script?
Using chatgpt I cant get the code to work in java and wasn't sure if this was possible.
This should do the trick:
Before:
After:
Then you can set properties for the ObjectStyle.
Copy link to clipboard
Copied
Yes, everything you can do manually in UI - can be scripted:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#AnchoredObjectSetting.html
Copy link to clipboard
Copied
Thank you!
Copy link to clipboard
Copied
How can we target the anchored objects? Are they the only anchored objects in the doc? Do they have unique extensions (ie png or psd) from other images in the doc? Do they have Object Styles applied? Are other Object Styles in use in thr doc?
Copy link to clipboard
Copied
The object is a library element that I just tend to copy and paste into the text box and then anchor accordingly. These symbols are the only anchored object in the doc and have no object styles apploed.
Copy link to clipboard
Copied
This should do the trick:
Before:
After:
Then you can set properties for the ObjectStyle.
Copy link to clipboard
Copied
I have set this up but I dont think its recognising the symbols an an object? Coming up as found 0 object. For more detail - they are symbols created in illustrator that are imported into our libraries.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Try a find for [Basic Graphics Frame] instead of [None]
Copy link to clipboard
Copied
Or, click on one of the objects and see what Object Style is applied.
Copy link to clipboard
Copied
Hi @Niko32511349sm76, this script tries to do what you want. You need to set up the object style first, and put the correct name for the object style into the script (replace 'My Object Style Here').
- Mark
/**
* Apply Object Style To All Anchored Objects
* @author m1b
* @discussion https://community.adobe.com/t5/indesign-discussions/how-to-script-anchor-allignments-with-objects/m-p/14549295
*/
function main() {
var anchoredObjectStyleName = 'My Object Style Here';
var doc = app.activeDocument,
objectStyle = doc.objectStyles.itemByName(anchoredObjectStyleName);
if (!objectStyle.isValid)
return alert('Could not find object style "' + anchoredObjectStyleName + '".');
doc.stories.everyItem().pageItems.everyItem().appliedObjectStyle = objectStyle;
};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Apply Object Style To Anchored Objects');