adobe-extension-tools / cep-starter

A starter project for developing CEP extensions using the cep-bundler and cep-packager
http://www.mtmograph.com
19 stars 2 forks source link

Once the jsx code error can not be executed again #2

Open sumhah opened 6 years ago

sumhah commented 6 years ago

If the jsx code error, the script does not take effect after the change, i must restart photoshop, reopen the cep expansion in order to properly execute the script.

E.g: if i run this code: console.log(app.activeDocument.activeLayer.textItem.contents)

jsx code can not be executed again after the next change

vespakoen commented 6 years ago

I think this has to do with Photoshop, I haven't experienced this in After Effects, You could try catching all errors and logging them to the console, you can copy the code from here:

https://github.com/adobe-extension-tools/extendscript-starter/blob/03588dfb78c836ad0c02a5e36937d368d6528171/src/AfterEffects/core/utils.ts#L1-L25

and here:

https://github.com/adobe-extension-tools/extendscript-starter/blob/03588dfb78c836ad0c02a5e36937d368d6528171/src/AfterEffects/core/utils.ts#L74-L83

Then use it like this:

catchErrors(() => {
  console.log(app.activeDocument.activeLayer.textItem.contents)
})