EDOBE XDOM EM Spécifications Page 169

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 231
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 168
Adobe Photoshop CS6
JavaScript Scripting Reference JavaScript Object Reference 169
var startTypeUnits = app.preferences.typeUnits
var startDisplayDialogs = app.displayDialogs
// Set Adobe Photoshop CS6 to use pixels and display no dialogs
app.preferences.rulerUnits = Units.PIXELS
app.preferences.typeUnits = TypeUnits.PIXELS
app.displayDialogs = DialogModes.NO
//Close all the open documents
while (app.documents.length) {
app.activeDocument.close()
}
//Create variables for the 800 pixel board divided in even 100 x 100 squares
var docSize = 800
var cells = 8
var cellSize = docSize / cells
// create a new document
var checkersDoc = app.documents.add(docSize, docSize, 72, "Checkers")
// Create a variable to use for selecting the checker board
// That allows me to shift the selection one square to the right
//on every other row, and then shift back for the rows in between.
var shiftIt = true
// loop through vertically to create the first row
for (var v = 0; v < docSize; v += cellSize) {
// Switch the shift for a new row
shiftIt = !shiftIt
// loop through horizontally
for (var h = 0; h < docSize; h += (cellSize * 2)) {
// push over the cellSize to start with only
if (shiftIt && h == 0) {
h += cellSize
}
// Select a square
selRegion = Array(Array(h, v),
Array(h + cellSize, v),
Array(h + cellSize, v + cellSize),
Array(h, v + cellSize),
Array(h, v))
// In the first ineration of the loop, start the selection
//In subsequent iterations, use the EXTEND constant value
//of the select() method to add to the selection (in the loop’s else clause)
if (h == 0 && v == 0) {
checkersDoc.selection.select(selRegion)
} else {
checkersDoc.selection.select(selRegion, SelectionType.EXTEND)
}
// turn this off for faster execution
// turn this on for debugging
WaitForRedraw()
}
Vue de la page 168
1 2 ... 164 165 166 167 168 169 170 171 172 173 174 ... 230 231

Commentaires sur ces manuels

Pas de commentaire