Here's what I put together years ago. It still works in Photoshop CS5. Be forewarned that the code contains no error trapping or data validation, such as whether the provided color name already exists.
AFAIK, there's no way to make a swatch without _javascript_. I took advantage of Adobe's ScriptingListener plug-in to capture the raw code, which I cleaned up and made more human-readable.
Stan C.
set colorName to "Some Green"
set cPercent to 50.0
set mPercent to 5.0
set yPercent to 100.0
set kPercent to 25.0
makeNewSwatch(colorName, cPercent, mPercent, yPercent, kPercent)
on makeNewSwatch(colorName, cPercent, mPercent, yPercent, kPercent)
tell application "Adobe Photoshop CS5"
activate
do _javascript_ ("function makeNewSwatch(colorName, cPercent, mPercent, yPercent, kPercent)
{
var emptyColor = new ActionReference();
emptyColor.putClass( charIDToTypeID( \"Clrs\" ) );
var colorParameters = new ActionDescriptor();
colorParameters.putDouble( charIDToTypeID( \"Cyn \" ), cPercent );
colorParameters.putDouble( charIDToTypeID( \"Mgnt\" ), mPercent );
colorParameters.putDouble( charIDToTypeID( \"Ylw \" ), yPercent );
colorParameters.putDouble( charIDToTypeID( \"Blck\" ), kPercent );
var colorDefinition = new ActionDescriptor();
colorDefinition.putString( charIDToTypeID( \"Nm \" ), colorName );
colorDefinition.putObject( charIDToTypeID( \"Clr \" ), charIDToTypeID( \"CMYC\" ), colorParameters );
var newSwatch = new ActionDescriptor();
newSwatch.putReference( charIDToTypeID( \"null\" ), emptyColor );
newSwatch.putObject( charIDToTypeID( \"Usng\" ), charIDToTypeID( \"Clrs\" ), colorDefinition );
executeAction( charIDToTypeID( \"Mk \" ), newSwatch, DialogModes.NO );
}
makeNewSwatch( arguments[0] , arguments[1] , arguments[2] , arguments[3] , arguments[4] );") ¬
with arguments {colorName, cPercent, mPercent, yPercent, kPercent}
end tell
end makeNewSwatch