
Adobe Photoshop CS3
JavaScript Scripting Reference
JavaScript Object Reference 170
// Fill the current selection with the foreground color
checkersDoc.selection.fill(app.foregroundColor)
//Invert the selection
checkersDoc.selection.invert()
// Fill the new selection with the background color
checkersDoc.selection.fill(app.backgroundColor)
// Clear the selection to get rid of the non-printing borders
checkersDoc.selection.deselect()
// Reset the application preferences
app.preferences.rulerUnits = startRulerUnits
app.preferences.typeUnits = startTypeUnits
app.displayDialogs = startDisplayDialogs
// A helper function for debugging
// It also helps the user see what is going on
// if you turn it off for this example you
// get a flashing cursor for a number (long) time
function WaitForRedraw()
{
var eventWait = charIDToTypeID("Wait")
var enumRedrawComplete = charIDToTypeID("RdCm")
var typeState = charIDToTypeID("Stte")
var keyState = charIDToTypeID("Stte")
var desc = new ActionDescriptor()
desc.putEnumerated(keyState, typeState, enumRedrawComplete)
executeAction(eventWait, desc, DialogModes.NO)
}