PhotoShop中创建棋盘格的脚本
来源:互联网 发布:阿里云搭建视频教程 编辑:程序博客网 时间:2024/05/01 18:31
// Save the current preferencesvar startRulerUnits = app.preferences.rulerUnitsvar startTypeUnits = app.preferences.typeUnitsvar startDisplayDialogs = app.displayDialogs// Set Adobe Photoshop CS5 to use pixels and display no dialogsapp.preferences.rulerUnits = Units.PIXELSapp.preferences.typeUnits = TypeUnits.PIXELSapp.displayDialogs = DialogModes.NO//Close all the open documentswhile (app.documents.length) {app.activeDocument.close()}//Create variables for the 800 pixel board divided in even 100 x 100 squaresvar docSize = 800var cells = 8var cellSize = docSize / cells// create a new documentvar 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 rowfor (var v = 0; v < docSize; v += cellSize) {// Switch the shift for a new rowshiftIt = !shiftIt// loop through horizontallyfor (var h = 0; h < docSize; h += (cellSize * 2)) {// push over the cellSize to start with onlyif (shiftIt && h == 0) {h += cellSize}// Select a squareselRegion = 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 debuggingWaitForRedraw()}}// Fill the current selection with the foreground colorcheckersDoc.selection.fill(app.foregroundColor)//Invert the selectioncheckersDoc.selection.invert()// Fill the new selection with the background colorcheckersDoc.selection.fill(app.backgroundColor)// Clear the selection to get rid of the non-printing borderscheckersDoc.selection.deselect()// Reset the application preferencesapp.preferences.rulerUnits = startRulerUnitsapp.preferences.typeUnits = startTypeUnitsapp.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 timefunction 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)}
0 0
- PhotoShop中创建棋盘格的脚本
- Photoshop脚本 > 创建一个选区
- PhotoShop中显示当前PS信息的脚本
- as3 调用photoshop 脚本 :创建一组文件夹
- Photoshop脚本 > 同时创建多个选区
- photoshop脚本:批量更改图片尺寸的脚本
- Photoshop脚本 > 设置使用脚本的快捷键
- Photoshop脚本 > 使用脚本创建一个新文档
- Photoshop脚本 > 打开文件夹中所有文档
- Photoshop脚本 > 创建新文档和文字图层
- Photoshop脚本 > 通过拷贝创建一个图层
- Photoshop CS5的JS脚本进一步探索
- Photoshop脚本 > 遍历最近打开的文档
- Photoshop脚本 > 输出当前文档的信息
- Photoshop脚本 > 打开一个存在的文档
- Photoshop脚本 > 打开一个存在的文档
- Photoshop脚本 > 图像的亮度和对比度
- Photoshop脚本 > 色彩平衡的使用
- 反射类就可以间接调用目标Class的各项功能
- ftp主动与被动
- 第一篇博文
- 浅述extern C的用法 和 无导入表PE的实现
- ipv6禁用
- PhotoShop中创建棋盘格的脚本
- @Resource annotation is not supported on static fields
- 用PHP的ob_start()控制您的浏览器cache
- 用DexClassLoader实现加壳
- CAS实现单点登录(SSO)经典完整教程
- <<给你个团队你能怎么管>>读书笔记-1
- LICEcap
- Roman to Integer
- logrotate 安装配置