jardicc / alchemist

DevTool for plugin developers
MIT License
180 stars 21 forks source link

Action set does not work #35

Open redhatt06 opened 1 year ago

redhatt06 commented 1 year ago

I am using newest version of Photoshop 2024 and Installed Alchemist from CreativeCloud. When I copy and paste the generated action code to my script. It gets stuck at some commands in the action set. Action set works as expected in Photoshop when I run it from .atn file but when I use the code generated from Alchemist It gets stuck at some commands. So, it works until the point it gives error then Photoshop gives program error. There is no error log so I cannot give more info but I found error on two different cases where one of them is a make Layer command and other is move to front command.

jardicc commented 1 year ago

I think I know what is going on. In PS 24.5.0/24.6.0 you should be able to add additional property to continue on fail. It does not exist prior to this version. Use it like this await psAction.batchPlay([failingCommand, command], {"continueOnError": true});

Please use it with care as it will fail silently and it will not be enough to check the last only descriptor in the returned array for an error. You would need to check all of them instead and asses how would you handle this situation. This really makes only sense when need 1:1 .ATN file conversion.

Once this option will in the public release of Photoshop I want to update the Alchemist plugin.

redhatt06 commented 1 year ago

Thanks, I will try it out and let you know. But I did not understand one point. I have an action set with let's say 10 commands that needs to work consequtively, if it fails at the 3rd command and continues, then it will not execute the 3rd command right? Then it will break my action set or is this failing for a different reason and we are just bypassing the error with this silent option?

jardicc commented 1 year ago

Yes, but you have different reasons for a failure. E.g. if you want to move the topmost layer at the topmost position then the action will fail. I can't be done because it is already there. But executing that action would change nothing. Conditions are already met therefore this does not cause problems in sequence. There are a few more cases like this. In best case you would use DOM and it would not throw an error as this is not a real problem. In batchPlay alternative is to check the condition and not execute in such cases.

redhatt06 commented 1 year ago

I thought I have the highest version but my Photoshop version is currently 24.3. This is the latest version I can install from CreativeCloud. So I guess I cannot use your suggestion at the moment. Also, how about the 'make' command case, is it possible that some state in photoshop can also block that command from executing? And, by "alternative is to check the condition and not execute in such cases" You mean that I split the action set into little parts and check conditions in between them? I don't understand why while it is working okay when I run from .atn file it works but not with script. I don't know much knowledge about photoshop and commands. I just need to convert actions sets from .atn files to scripts to be able to run from a panel. What would be your suggestion for me? I could manually write the actions sets from javascript as well but I don't understand this JSON command format. I could not find any documentation or guide on this as well? Sorry for asking too many questions but I could not find a better place :)

jardicc commented 1 year ago

I think you should check in CC for new versions... today there should be 24.5 available in stable release and 24.6 in beta release.

Do you want to use it only for your own need or also distribute the plugin to other users?

Make command will fail e.g. if your document is in indexed color mode. There cannot be layers therefore it cannot create one.

redhatt06 commented 1 year ago

I want to distribute it to others. I have been given some action sets as .atn files to be integrated into a panel then packaged to be sold or listed on CreativeCloud. I could not find a documentation for this so I can understand what is done in the .atns and maybe convert it to Photoshop API.

jardicc commented 1 year ago

If you want to distribute then you should go for high-quality and bulletproof solutions. Also, consider what PS version you want to aim... what is the minimal PS version that you would like to support.