摘要:Adobe Photoshop脚本自动化技术是广泛采用的一种技术,它和Adobe Photoshop插件开发不是一个东西。从Photoshop入门学习中,我们可以了解基于PS SDK的插件开发主要是在PS内部提供一些复杂的、高性能的图片处理工具,而PS脚本自动化技术则多用于图片的批处理。本文就向大家展示Photoshop入门学习的脚本自动化技术。
Photoshop入门学习之Adobe Photoshop脚本自动化技术
Adobe Photoshop脚本自动化技术是广泛采用的一种技术,它和Adobe Photoshop插件开发不是一个东西。从Photoshop入门学习中,我们可以了解基于PS SDK的插件开发主要是在PS内部提供一些复杂的、高性能的图片处理工具,而PS脚本自动化技术则多用于图片的批处理。本文就向大家展示Photoshop入门学习的脚本自动化技术。
在Adobe Photoshop的安装目录下,有一个Scripting文件夹,里面包含了PS脚本自动化技术的文档和参考脚本样例。
其中打开文档的vbs脚本内容如下:
[vb] view plain copy 1. ' Copyright 2002-2008. Adobe Systems, Incorporated. All rights reserved. 2. ' This script demonstrates how to open a Photoshop document from the samples folder 3. 4. Option Explicit 5. 6. Dim appRef 7. Dim docRef 8. Dim fileName 9. 10. Dim strSamples 11. Dim strLayerComps 12. Dim strLocString 13. Dim strArg 14. 15. Set appRef = CreateObject( "Photoshop.Application" ) 16. 17. appRef.BringToFront 18. 19. strSamples = "$$$/LocalizedFilenames.xml/SourceDirectoryName/id/Extras/[LOCALE]/[LOCALE]_Samples/value=Samples" 20. strArg = Array(strSamples) 21. Call getLocString(strSamples) 22. 23. strLayerComps = "$$$/LocalizedFilenames.xml/SourceFileName/id/Extras/[LOCALE]/[LOCALE]_Samples/Layer_Comps.psd/value=Layer Comps.psd" 24. strArg = Array(strLayerComps) 25. Call getLocString(strLayerComps) 26. 27. fileName = appRef.Path & "\" & strSamples & "\" & strLayerComps 28. Set docRef = appRef.Open( fileName ) 29. 30. MsgBox "Open Document complete" 31. 32. ' =============================================== 33. ' getLocString functions 34. ' =============================================== 35. ' on localized builds we pull the $$$/Strings from a .dat file, see documentation for more details 36. Function getLocString(strLocString) 37. 38. Dim objWshShell 39. Dim myScriptPath 40. Dim myFSO 41. Dim strJSXFile 42. 43. Set objWshShell = WScript.CreateObject("WScript.Shell") 44. myScriptPath = objWshShell.CurrentDirectory 45. Set myFSO = CreateObject("Scripting.FileSystemObject") 46. strJSXFile = myScriptPath + "\localize.jsx" 47. 48. strLocString = appRef.DoJavaScriptFile(strJSXFile,Array(strLocString),1) 49. 50. End Function
转换为VC代码如下:
[cpp] view plain copy 1. CApplication m_app; 2. if(!m_app.CreateDispatch("Photoshop.Application")) 3. { 4. MessageBox("PS初始化失败"); 5. PostQuitMessage(0); 6. } 7. m_app.Open("D:\\1.psd");
在PS中进行脚本录制,完成后,在采用编码的方式将录制的多个脚本(一般为jsx)拼合为一个应用程序,加上辅助一些文件管理、业务逻辑等,可以解决一些比较复杂的图片批处理需求了。
本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注常用软件Photoshop频道!
您输入的评论内容中包含违禁敏感词
我知道了
请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号