There is no such thing.
However: if you have the reference to a swatch (for example, by index), you can manipulate it: duplicate, remove, change its color, etc.
I assume your goal is not to select a swatch as such, but rather do something to/with one. If you explain a bit more, there might be a more conventional way to do what you intend.
Thanks for your post. I understand what you are saying and perhaps I wasn't clear enough in explaining what I needed. I wanted to select a color swatch so that the next object the user drew would be the color my script selected. I discovered and settled on the following after much pain:
myDoc.selection = NothingEnum.nothing; // deselect all objects to prevent replacing the color of an object that might be selected already
myDoc.pageItemDefaults.strokeColor = "None"; // set document default stroke color to "None"
myDoc.pageItemDefaults.fillColor = "red"; // set document default fill color to "red" where "red" is the name of the color I wanted
This might "encourage" (or make it easier for) the user to draw objects in the color I've left him/her auto-selected to.
Yes, I see what you intend.
Setting the default fill and stroke does the trick -- that's entirely similar to what happens in the UI as well.
You could add this a refinement: if the user has one or more objects selected, you could apply the color. Something like
if (app.selection.length > 0)
for (var i=0; i<app.selection.length; i++)
app.selection[i].fillColor = app.activeDocument.swatches[myFill];
app.selection[i].strokeColor = app.activeDocument.swatches[myStroke];