Make multiple area selections in Photoshop CS2

Hello,

I’m looking to select two areas on a page defined by their four coordinates. I have no problem selecting and clearing out the contents of one area, but when I try and find a way to select another area leaving the original area still selected (same as holding down shift key while selecting subsequent areas), I can’t find a way. I even tried using System Event for a shift key press, but that didn’t work. The Photoshop dictionary indicates there’s a way by using combination type, but I can’t get the syntax correct. I’m fairly new to this, and it could be me, but I have a hard time decyphering the Applescript dictionaries for scriptable applications.

Here is the excerpt from the Photoshop CS2 dictionary:

select‚v : change the selection
select document : the document object or objects to be operated upon
region list of anything : list of corners of the selection (in pixels)
[combination type diminished/extended/intersected/replaced] : how to combine the new selection with the existing selection ( default: replaced )
[feather amount real] : feather amount ( default: 0.0 )
[antialiasing boolean] : whether to use antialiasing ( default: true )

The following works to do one area, but I can’t figure out how to add the second array of coordinates. I thought combination type:extended and the second list of area coordinates, but that gives an error.

select current document region {{8, 87}, {222, 87}, {222, 106}, {8, 106}}

Any help would be appreciated.

Regards,

Zoar

Model: G5 Dual
AppleScript: 1.0 ?
Browser: Safari 417.8
Operating System: Mac OS X (10.4)

took a little experimentation - but here you go:

tell application "Adobe Photoshop CS2"
	tell current document
		set y to {{8, 150}, {222, 150}, {222, 250}, {8, 250}}
		set x to {{8, 87}, {222, 87}, {222, 106}, {8, 106}}
		set z to x & y
		select region z
	end tell
end tell

This works just fine for me in CS1.

tell application "Adobe Photoshop CS"
	tell current document
		set MySelect1 to select region {{8, 150}, {222, 150}, {222, 250}, {8, 250}}
		set MySelect2 to select region {{8, 87}, {222, 87}, {222, 106}, {8, 106}} combination type extended
	end tell
end tell

nice Mark - that works in CS2 as well - and I like it better - becasue it’s the ‘right’ way to do it…as opposed to my hack. I’m just so used to having to create hacks for applescript I guess…

Thanks Guys,

I knew it had to do with the extended combination type, but not how the syntax works. I tried using it as a property of the region and got syntax errors. I did try using two variables and then setting the region that way. What happens there is that it selects a line that connects the two areas (unfortunately running through my image area) as well.

I’m going to try your latest suggestion.

Thanks again,

Regards,

Zoar