@Chinna – interesting…
Let's discuss your code:
Snippet #1:
//Select ALL OBJECTS on the active page: app.select(app.activeWindow.activePage.allPageItems);
opposed to the following one I did:
Snippet #2:
//Select ALL first level objects on the active page: app.select(app.activeWindow.activePage.pageItems.everyItem().getElements());
What can go wrong with both script snippets?
The user might not expect that page items on locked layers are selected.
Or that page items on invisible layers are selected.
What can go wrong with snippet #1 additionally?
Nested objects are selected as well. This might be good or not. Depends on the user's expectation.
Usually that would be contrary to something you can do with graphical user interface of InDesign.
You can try doing it with the Layers Panel, but you will not succeed. You cannot do it with a menu command; that's for sure.
Example 1 of nested objects (a circle pasted inside a rectangle) before running snippet #1:
Selection after running snippet #1:
Now, what does this mean?
If the user would apply a fill color to the selection, ALL page items would get the fill. Also the nested circle.
In contradiction to that, what would happen after using the menu command Select All where only first level page items can be selected.
(In this example the rectangle)
Let's go on with nested objects and the allPageItems array.
Example 2, some rectangles on the page plus a text frame with an anchored text frame:
After running snippet #1 only the anchored text frame is selected. And that is really opposed to the user's expectation.
So, without testing any further, I would not recommend using the allPageItems array with app.select().
I'd go for my snippet #2 that might also not meet all the user's expectations (e.g.: objects on invisible layers are selected).
Or maybe better, I would write a script that implies invoking the menu command Select All and weeding out the unwanted page items on the pasteboard and on all not active pages of the active spread.
Uwe