Hi Qing, Hi Robert,
First, please accept my sincere apologies for not responding to your replies. I got stuck somewhere and couldn’t got the time to test these additions.
My initial requirement was to fit all the inline images in the story in the selected text frame. I tested both the scripts given by you (Qing and Robert) and they worked well.
Qing’s script was fixing all the inline images of the selected text frame but not in the whole story. I didn’t realized that Robert’s script was in fact fixing all the inline images in the whole story of the selected text frame. Secondly, to center align the inline images was an optional thought, which I fixed by updating the para style for the inline images.
Qing, your changes to the script worked the way I wanted:
var allRtg = myObject.parentStory.rectangles.everyItem().getElements();
This helps me fix all the inline images within the story.
Robert, your first script as I said worked well. The new updated code gives me a new thought as the new code was fixing all the inline images within the document. So I have saved this as a separate script for future requirements.
I must say, that now I have three scripts:
1) Fix all inline images within a Document.
2) Fix all inline images within a Story.
3) Fix all inline images within a TextFrame.
Thanks a ton to both of you :)