This script moves horizontally selection or spread contents to the pasteboard or moves them back to the pages.
I designed this script from an idea from Christophe Navarro, graphic designer from Nice frequently laying out real estate magazines, who recently wrote me he could use a script that
- if nothing is selected on a page or spread, would move sideways (only on the x axis, preserving the y coordinate) all the content from each page (except items on locked layers) to the pasteboard (to the left side for left hand pages, to the right side for right hand or single sided pages),
- if some items are selected (on a single page or ideally on the active spread) would move sideways the selection to the pasteboard (left or right according to the page).
I happened myself, many years ago (before I started to write scripts) to layout periodically a classified ads paper and I too used each month to first move to the pasteboard all the advertising inserts from the previous edition, in order to keep on hand those that might possibly feature again on the upcoming edition. Some forum posts show that other people have the same habit and submitted similar script requests https://forums.adobe.com/message/10360577 https://forums.adobe.com/message/3639583 so I considered publishing my version for all graphic designers who could possibly use it.
So this script moves outside to the pasteboard all selected items or, in case of no selection, all visible and unlocked items from the active spread, to an horizontal distance based on the pages width, automatically increased by the optional bleed/slug offset, coping with spreads including 3 or more pages (for example a cover with flaps), automatically increasing the pasteboard margins if needed to prevent moved items from disappearing outside.
If you run the script again on selected items previously moved to the pasteboard, the script moves them back to their original position.
 Whatever the page count in the spread, the page items moving direction (right or left) will depend on the "side" page property, that depends on its position from the binding vertical line visible on the "Pages" panel if the document is actually in "Facing Pages" mode. For a document in single pages mode, the direction will always be to the right even if you manually create multi-page spreads.
 Or to a possibly different place if some parameters such as the pages size, the page count in the spread or the bleed/slug offset have been changed meanwhile.