简体   繁体   中英

Adobe CEP 8 Photoshop-Image-Import

I created a PremierePro Extension which could download and import a file to a project. The same extension unfortunately does not work under Photoshop, because the host scripts app instance doesn't contain a project. I tried out different formats like .psd, but no project appears.

hostScript.jsx:

app.project // === null

I import the file I downloaded by this command:

csInterface.evalScript("app.project.importFiles(['" + fullPath + "'])");

Due to the fact that I can't debug the host scripts I'm a bit stucked. I havn't found an example of importing files to photoshop either.

Does anyone have a clue how to import a file to photoshop, or is there another way to create a explicit project?

Photoshop doesn't have projects, in fact dom for all of the Adobe products is slightly different. You can check PS JS reference ( https://wwwimages2.adobe.com/content/dam/acom/en/devnet/photoshop/pdfs/photoshop-cc-javascript-ref.pdf ) for more info. For example you can open files with app.open(). To debug hostscripts I encapsulate everything to functions with try-catch (and never call for dom functions from csinterface), but I think there're also more comprehensive solutions.

这只是打开命令:

csInterface.evalScript("app.open(File('" + encodeURIComponent(fullPath) + "'));");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM