Photoshop插件--关闭--关闭全部--退出--脚本开发--PS插件
作者:互联网
文章目录
PS是一款栅格图像编辑软件,具有许多强大的功能,本文演示如何通过脚本实现关闭、关闭全部和退出相关功能,展示从互联网收集而来的一个小插件,供大家学习交流,请勿用于商业用途。
1.插件界面
本文界面是一系列功能的一部分,将逐步展示,但是功能界面是共同的,如下图所示:
2.关键代码
2.1 关闭
大家可通过源代码阅读,来掌握相关技巧,源代码如下:
ErrStrs = {};
ErrStrs.USER_CANCELLED = localize("$$$/ScriptingSupport/Error/UserCancelled=User cancelled the operation");
try {
var idClssp = charIDToTypeID('Cls ');
executeAction(idClssp, undefined, DialogModes.ALL);
} catch (e) {
if (e.toString().indexOf(ErrStrs.USER_CANCELLED) != -1) {
;
} else {
alert(localize("$$$/ScriptingSupport/Error/CommandNotAvailable=The command is currently not available"));
}
}
2.2 关闭全部
大家可通过源代码阅读,来掌握相关技巧,源代码如下:
ErrStrs = {};
ErrStrs.USER_CANCELLED = localize("$$$/ScriptingSupport/Error/UserCancelled=User cancelled the operation");
try {
var idslct = charIDToTypeID('slct');
var desc1094 = new ActionDescriptor();
var idnull = charIDToTypeID('null');
var ref879 = new ActionReference();
var idMnspsp = charIDToTypeID('Mn ');
var idMnIt = charIDToTypeID('MnIt');
var idClsA = charIDToTypeID('ClsA');
ref879.putEnumerated(idMnspsp, idMnIt, idClsA);
desc1094.putReference(idnull, ref879);
executeAction(idslct, desc1094, DialogModes.ALL);
} catch (e) {
if (e.toString().indexOf(ErrStrs.USER_CANCELLED) != -1) {
;
} else {
alert(localize("$$$/ScriptingSupport/Error/CommandNotAvailable=The command is currently not available"));
}
}
2.3 退出
大家可通过源代码阅读,来掌握相关技巧,源代码如下:
ErrStrs = {};
ErrStrs.USER_CANCELLED = localize("$$$/ScriptingSupport/Error/UserCancelled=User cancelled the operation");
try {
var idquit = charIDToTypeID('quit');
executeAction(idquit, undefined, DialogModes.ALL);
} catch (e) {
if (e.toString().indexOf(ErrStrs.USER_CANCELLED) != -1) {
;
} else {
alert(localize("$$$/ScriptingSupport/Error/CommandNotAvailable=The command is currently not available"));
}
}
3.作者寄语
合理的脚本代码可以有效的提高工作效率,减少重复劳动。
欢迎光临知了软件开发网络平台,本公司定制开发各类软件,主要方向为桌面专业软件开发、插件定制开发、微信小程序(各类小程序)、网站定制开发和App开发,桌面软件主要包括文字图形识别类软件,信息管理类软件,3D打印类软件,视频类软件以及其它涉及专业的各类图形图像处理软件。插件包含AE插件,AI插件,PS插件,PDF插件,3DMAX插件以及Word,Excel等Office插件开发。详情请咨询,微信QQ:312117271,手机:18928899728,邮箱: anjingzhi_sea@163.com.
公司网址:http://www.zhiliaos.com
标签:插件,--,charIDToTypeID,ErrStrs,ScriptingSupport,关闭,var,源代码 来源: https://blog.csdn.net/weixin_42247427/article/details/121901866