当前位置:网站首页>Photoshop plug-in action related concepts actionlist actiondescriptor actionlist action execution load call delete PS plug-in development
Photoshop plug-in action related concepts actionlist actiondescriptor actionlist action execution load call delete PS plug-in development
2022-07-05 14:40:00 【Plug in development】
List of articles
1. brief introduction
PS What's the action ? It is a combination of a set of operation steps , Multiple steps are assembled into oneortwo steps to complete complex operations . stay PS Inside , It is managed through the action panel , Recording , edit , Load and execute . As shown in the figure below :
2. Action related concepts
2.1.ActionDescriptor
This object provides a lexicographic mechanism , Used to store data as Key value pair . It can be used to Photoshop Low level access . Many configuration files use serialization operation descriptors to represent their data . for example , Used in Application.playbackParameters Package playback options , And by the Application.getCustomOptions().
2.2.ActionList
This object provides an array mechanism for storing data . It can be used to Photoshop Low level access . When storing the same type of data , This object is ideal . All items in the list must be of the same type . You can use things like putBoolean() And so on. “put” Method to attach new elements , And you can use clear() Clear the entire list , But you cannot modify the list in other ways . Be careful :ActionList The object is Action Manager Part of the function . For more information about using the action manager , see also Photoshop CC Script guide .
2.3.ActionReference
This object provides information about what the operation refers to . for example , When it comes to the name of something , You may use keyName. The reference also needs to know what name you mean . under these circumstances , You can use classDocument As the document name or use classLayer As the layer name . It can be used to Photoshop Low level access . Include and ActionDescriptor Associated data .
3. Example
3.1. Load action
Load the action file into the panel , The code is as follows :
app.load(File("C:\\2.atn"));
3.2. Executive action
Call the function to execute the corresponding group and the corresponding name function , The code is as follows :
play_action(" Default action ", " Quarter color ");
//play_action(" Default action ", " Quarter color ") // Perform the whole action// Perform the whole action
//play_action(" Default action ", " Quarter color ", 4, true) // Complete all from the beginning of the command number 4// From the command number 4 Complete the beginning of
//play_action(" Default action ", " Quarter color ", 5, false) // Will execute only command number 5// Only execute the command number 5
//cmd_number - the index of the command, ( starts from 1 )
function play_action(set, action, cmd_number, allow_continue)
{
try
{
var d = new ActionDescriptor();
var r = new ActionReference();
if (typeof(cmd_number) == "number") r.putIndex( charIDToTypeID( "Cmnd" ), cmd_number );
r.putName( charIDToTypeID( "Actn" ), action );
r.putName( charIDToTypeID( "ASet" ), set );
d.putReference( charIDToTypeID( "null" ), r );
if (typeof(allow_continue) == "boolean") d.putBoolean( charIDToTypeID( "Cntn" ), allow_continue );
executeAction( charIDToTypeID( "Ply " ), d, DialogModes.NO );
}
catch(e)
{
alert(e);
}
}
3.3. Actions in the non loading execution action file
By non loading , Execute the actions in the action file , The code flow is long , There is a special blog introduction .https://anjingzhi.blog.csdn.net/article/details/121544253
3.4. Delete action set
Delete action set by name . The code is as follows :
delete_actionset(" Group 1");
function delete_actionset(set)
{
try
{
var idDlt = charIDToTypeID( "Dlt " );
var desc24 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref5 = new ActionReference();
var idASet = charIDToTypeID( "ASet" );
ref5.putName( idASet, set );
desc24.putReference( idnull, ref5 );
executeAction( idDlt, desc24, DialogModes.NO );
}
catch(e)
{
alert(e);
}
}
3.5. Delete action
Delete actions by action set and action name . The code is as follows :
delete_action(" Group 1"," action 1");
function delete_action(set,action)
{
try
{
var idDlt = charIDToTypeID( "Dlt " );
var desc6 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref3 = new ActionReference();
var idActn = charIDToTypeID( "Actn" );
ref3.putName( idActn, action );
var idASet = charIDToTypeID( "ASet" );
ref3.putName( idASet, set);
desc6.putReference( idnull, ref3 );
executeAction( idDlt, desc6, DialogModes.NO );
}
catch(e)
{
alert(e);
}
}
4. The author's message
Reasonable script code can effectively improve work efficiency , Reduce repetitive labor .
边栏推荐
- 周大福践行「百周年承诺」,真诚服务推动绿色环保
- 开挖财上的证券账户可以吗?安全吗?
- 有一个强大又好看的,赛过Typora,阿里开发的语雀编辑器
- 直播预告|如何借助自动化工具落地DevOps(文末福利)
- SaaS multi tenant solution for FMCG industry to build digital marketing competitiveness of the whole industry chain
- 分享 20 个稀奇古怪的 JS 表达式,看看你能答对多少
- Interview shock 62: what are the precautions for group by?
- 做自媒體視頻二次剪輯,怎樣剪輯不算侵權
- Handwriting promise and async await
- CPU设计实战-第四章实践任务三用前递技术解决相关引发的冲突
猜你喜欢
729. 我的日程安排表 I :「模拟」&「线段树(动态开点)」&「分块 + 位运算(分桶)」
leetcode:881. lifeboat
Under the crisis of enterprise development, is digital transformation the future savior of enterprises
【华为机试真题详解】字符统计及重排
Share 20 strange JS expressions and see how many correct answers you can get
一键更改多个文件名字
Two Bi development, more than 3000 reports? How to do it?
PyTorch二分类时BCELoss,CrossEntropyLoss,Sigmoid等的选择和使用
网上电子元器件采购商城:打破采购环节信息不对称难题,赋能企业高效协同管理
World Environment Day | Chow Tai Fook serves wholeheartedly to promote carbon reduction and environmental protection
随机推荐
STM32+BH1750光敏传感器获取光照强度
The function of qualifier in C language
日化用品行业智能供应链协同系统解决方案:数智化SCM供应链,为企业转型“加速度”
Drive brushless DC motor based on Ti drv10970
【leetcode周赛总结】LeetCode第 81 场双周赛(6.25)
mysql8.0JSON_CONTAINS的使用说明
Selection and use of bceloss, crossentropyloss, sigmoid, etc. in pytorch classification
[C question set] of Ⅷ
裁员下的上海
【NVMe2.0b 14-9】NVMe SR-IOV
手写promise与async await
Type declaration of all DOM elements in TS
CPU设计实战-第四章实践任务三用前递技术解决相关引发的冲突
选择排序和冒泡排序
03_ Dataimport of Solr
【华为机试真题详解】字符统计及重排
【招聘岗位】软件工程师(全栈)- 公共安全方向
Thymeleaf 常用函數
【C 题集】of Ⅷ
Strong connection component