Answered
I see what you mean, I hadn't thought of that. Here's an updated script to deal with that. It's a bit verbose but it'll keep me sane.
Note that instead of your paragraph style names "left anchor" and "right anchor" I used 'anchor left align' and 'anchor right align', which make more sense.
(function () {
var d = app.activeDocument;
var leftAlign = d.paragraphStyles.item ('anchor left align');
var rightAlign = d.paragraphStyles.item ('anchor right align');
var insideStyle = d.objectStyles.item ('anchor inside');
var outsideStyle = d.objectStyles.item ('anchor outside');
//--------------------------------------------------------
function positionFrame (frame) {
var side = frame.parentPage.side === PageSideOptions.LEFT_HAND
? 'left' : 'right';
var column = frame.parent.textColumns[0] == frame.parent.parentTextFrames[0].textColumns[0]
? 1 : 2;
if (side === 'left' && column === 1) {
frame.appliedObjectStyle = outsideStyle;
frame.texts[0].appliedParagraphStyle = rightAlign;
return;
}
if (side === 'left' && column === 2) {
frame.appliedObjectStyle = insideStyle;
frame.texts[0].appliedParagraphStyle = leftAlign;
return;
}
if (side === 'right' && column === 1) {
frame.appliedObjectStyle = insideStyle;
frame.texts[0].appliedParagraphStyle = rightAlign;
return;
}
if (side === 'right' && column === 2) {
frame.appliedObjectStyle = outsideStyle;
frame.texts[0].appliedParagraphStyle = leftAlign;
return;
}
}
//--------------------------------------------------------
var frames = d.stories.everyItem().textFrames.everyItem().getElements();
for (var i = 0; i < frames.length; i++) {
positionFrame (frames[i]);
}
}());
Sign up
Already have an account? Login
To post, reply, or follow discussions, please sign in with your Adobe ID.
Sign inSign in to Adobe Community
To post, reply, or follow discussions, please sign in with your Adobe ID.
Sign inEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.
