psd的js脚本

简介: psd的js脚本

我们可以随自己的高兴来认识这个世界,然而世界总少不了光明面和阴暗面。——歌德

今天研究了下psd的脚本

Photoshop 中的脚本

https://github.com/Adobe-CEP/CEP-Resources/tree/master/Documentation/Product specific Documentation/Photoshop Scripting

然后下载了脚本监视器插件,可以让我们在使用psd时生成对应的脚本

Downloadable plug-ins and content in Photoshop

然后解压,复制Scripting Utilties

粘贴到PS的路径下面的Plug-ins下面

重启ps即可,之后执行操作则会在桌面生成脚本文件

脚本内容:

// Copyright 2002-2007.  Adobe Systems, Incorporated.  All rights reserved.
// Create a new art layer and convert it to a text layer.
// Set its contents, size and color.
// enable double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop
// in case we double clicked the file
app.bringToFront();
// debug level: 0-2 (0:disable, 1:break on error, 2:break at beginning)
// $.level = 0;
// debugger; // launch debugger on next line
var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.INCHES;
app.preferences.typeUnits = TypeUnits.POINTS;
var docRef = app.documents.add(7, 5, 72);
// suppress all dialogs
app.displayDialogs = DialogModes.NO;
var textColor = new SolidColor;
textColor.rgb.red = 255;
textColor.rgb.green = 0;
textColor.rgb.blue = 0;
var newTextLayer = docRef.artLayers.add();
newTextLayer.kind = LayerKind.TEXT;
newTextLayer.textItem.contents = "Hello, World!";
newTextLayer.textItem.position = Array(0.75, 0.75);
newTextLayer.textItem.size = 36;
newTextLayer.textItem.color = textColor;
app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;
docRef = null;
textColor = null;
newTextLayer = null;

执行结果

相关文章
|
2月前
|
JavaScript 前端开发 测试技术
使用Selenium执行JavaScript脚本:探索Web自动化的新领域
本文介绍了如何在Selenium中使用JavaScript解决自动化测试中的复杂问题。Selenium的`execute_script`函数用于同步执行JS,例如滑动页面、操作时间控件等。在滑动操作示例中,通过JS将页面滚动到底部,点击下一页并获取页面信息。对于只读时间控件,利用JS去除readonly属性并设置新日期。使用JS扩展了Selenium的功能,提高了测试效率和精准度,适用于各种自动化测试场景。
52 1
|
2月前
|
JavaScript 前端开发 Java
liteflow规则引擎 执行Javascript脚本
liteflow规则引擎 执行Javascript脚本
47 1
|
4月前
|
移动开发 JavaScript 数据可视化
分享88个JS播放器脚本,总有一款适合您
分享88个JS播放器脚本,总有一款适合您
49 0
|
4月前
|
移动开发 JavaScript 前端开发
分享95个JS表单脚本,总有一款适合您
分享95个JS表单脚本,总有一款适合您
31 0
|
4月前
|
移动开发 JavaScript 前端开发
分享106个JS表单脚本,总有一款适合您
分享106个JS表单脚本,总有一款适合您
20 0
|
4月前
|
移动开发 JavaScript 前端开发
分享98个JS表单脚本,总有一款适合您
分享98个JS表单脚本,总有一款适合您
22 0
|
4月前
|
JavaScript 前端开发 Unix
Node.js Shell 脚本开发指南(中)
Node.js Shell 脚本开发指南(中)
62 0
|
4月前
|
JavaScript 前端开发 Shell
Node.js Shell 脚本开发指南(上)
Node.js Shell 脚本开发指南(上)
93 0
|
4月前
|
JavaScript 前端开发 Java
面试官:你的项目有什么亮点?我:解决了JS脚本加载失败的问题!
面试官:你的项目有什么亮点?我:解决了JS脚本加载失败的问题!
|
5月前
|
Android开发
Autox.js 脚本开发环境搭建,从案例到打包apk(详细流程)
Autox.js 脚本开发环境搭建,从案例到打包apk(详细流程)
523 0