InDesign combining 2 selections into 1

Surely this can be done?
I have a marquee that is selecting certain items of an InDesign document. I then intend to activate this script. The script will unlock a layer, select that layer’s content, and then add that selection to the items that were previously selected before the script ran.

Can anybody please help me out?


tell application "Adobe InDesign CS4"
activate
tell document 1
set mySelection to object reference of selection
			
--deselect the present active selection and then select the page items of a particular layer
select page items of layer "X-Blue_Background"
			
--storing this layer's selected objects as a variable
set mySelection2 to object reference of selection
			
--Now I want to select both the stored selections, but this obviously does not work.
set selection to (mySelection and mySelection2)
end tell
end tell

Well I was torn if I should retract this post?

This line seems to do the trick:

set selection to contents of (mySelection & mySelection2)

You probably don’t need the “contents of” – it was the use of “and” rather than “&” that gave you grief.

Shane,
I thank you once again. however, I have one more simple question, similar yet different.

If I had a reference to a selection, and then I obtained an object reference to an item within that larger selection, could I remove that object from the “larger” selection using something like this:

tell application "Adobe InDesign CS4"
	activate
	tell document 1
		set mySelectionBig to object reference of selection
		
		(* Within the script I selected an object that was within mySelectionBig, and now I want to remove it from mySelectionBig so I can cycle thru the items of mySelectionBig. *)
		
		set mySubSelection to object reference of selection
		
		set mySelectionDifference to (mySelectionBig - mySubSelection)
		
		set selection to mySelectionDifference
	end tell
end tell

I did not test this, primarily because I assumed it could not be this simple.

Short answer, no. You can’t use - with lists.