What I want to do is to be able to code a script which will change a text layer from a Photoshop file for another text in my script.
Is there anyway this can be done? Is there any Photoshop API or something similar?
There’s quite a lot you can do with custom scripting. There’s a lot to learn and it’s got kind of a steep learning curve at first because they have a lot of their own stuff, but it’s pretty powerful and flexible.
Here’s a list of resources to get you started: