johnleetran / ps-actions-samples

Example files for Photoshop Action API - https://www.adobe.io/photoshop/api/
3 stars 0 forks source link

How to pass variables to .atn file? #1

Open samp50old opened 4 years ago

samp50old commented 4 years ago

Hello, Thanks for making this repo, it's been helpful for me to learn how Action files work. I am wondering if anyone knows how to use variables in .atn files, after they have been made in Photoshop? Essentially what I am trying to do is pass four different numbers to an Action script when I select a part of the image; for example, this new number would occur after "LeftUntF#Pxl@" value in a script. Is anyone aware of how to do this with an .atn file after it is made?

johnleetran commented 4 years ago

Without being 100% sure of your use case...may I suggests using conditionals? https://helpx.adobe.com/photoshop/using/conditional-actions-creative-cloud.html

samp50old commented 4 years ago

John, Thanks for your response. I tried using conditionals. however they don't fit my use case. What I am basically trying to do is use Python to take a raw .atn file and replace four numeric variables with different values. Since the .atn file is in binary/raw encoding, I am not able to do this. Do you know of any way to substitute a value in for another value within the raw binary *.atn file?

johnleetran commented 4 years ago

I'm not sure if is an easy way to do what you are trying to do. The only solution i can give is to parse the action file, make the edit, and then write the file back to disk. Of course there are fancy ways to optimize the saving, but any reliable solution would mean to parse the file and write in back to disk.

Just wondering, do you think it would be useful for the Photoshop Services team to create a detected API to do what you are trying to do...if may i request you send an email to psdservices@adobe.com or contact our Product Manager? From what i read, it involves content-aware fill and you are trying to define the selection area...if so, we can easily expose a direct API to do that.

samp50old commented 4 years ago

Thanks for you help, John. I'll make that recommendation to Adobe.