A complicated(?) scripting question.
Copy link to clipboard
Copied
Background
I am a game designer currently working on a card game. My team is beginning to start testing the game online using the application Cockatrice. All of the important card information is stored in a google spreadsheet. I already have a .js script that converts the spreadsheet data into a .xml file that Cockatrice can interpret. However, cards appear blank in Cockatrice, unless they have an image of the full card linked to them. All of our cards are currently stored as separate .psd files. What this means is that if we want to tweak some values on a card, we first do it in the spreadsheet, but then must open the .psd file, manually fix the text layer, and then export a new image. This is a huge pain when making lots of changes.
Note: the .XML file contains the name of each card (which is identical to the names of the associated .psd files), as well as all the information for the card, separated in the same way and name that the corresponding text layers are in the .psd.
My system
Mac OSX 10.11.6
- Photoshop CS5 Extended v12.0.4 x64
What the Script should do
For each card in a given list of cards (Which I can format however it is easiest for PS to understand):
- Access/Open the .psd file with the same name as the card.
- Change the contents of all text layers to be the same as in the list.
- Save the .psd file.
- Save/Export the .psd file as an image file. (Could be .JPEG or .PNG)
- Close photoshop. (if it was opened)
I tried messing around with scripting a bit, but I wasn't able to get it to work as quickly as I'd like.
My goal is to be able to update all the necessary files, (.XML cardlist, .psd card files, .JPEG/.PNG card images, and anything else) using 2 or 3 total scripts. Any help with one or all of these steps would be greatly appreciated. I would prefer suggested scripts to be written in javascript if possible, but I'll take whatever I can get.
Explore related tutorials & articles
Copy link to clipboard
Copied
sbrow wrote:
What the Script should do
For each card in a given list of cards (Which I can format however it is easiest for PS to understand):
- Access/Open the .psd file with the same name as the card.
- Change the contents of all text layers to be the same as in the list.
- Save the .psd file.
- Save/Export the .psd file as an image file. (Could be .JPEG or .PNG)
- Close photoshop. (if it was opened)
1 A script can read a csv file you create using your spread sheet read the list of PSD files and process them xml files can alsi be read.
2 Text layers contents can be changed. It may be a bit hard to test if the changed content will fit where the old content fitted. All layer in a PSD document can be processed. However dealing with the mess you state your psd file are may be a problem for you.
3 Scripts can save psd file from documents you may be better off not saving over the original PSD files in case there are problems with your script processing.
4. you can save as many image file and image file types as you want like you can do with the image processor scripts.
5. If a script is going to close down Photoshop. It should first make sure there are no open documents. Perhaps you mean close and not save the psd documents you opened and process from your psd list.
Copy link to clipboard
Copied
Thank you for the reply! I'm glad to hear that all the things I am looking to do are possible. Could you point me in the right direction of which functions / methods I should look at to accomplish each step?
Copy link to clipboard
Copied

