Adding New Platforms - OptrixAU/xltoadobe GitHub Wiki

You can add additional platforms to the tool in a similar way to how you can create new actions.

First, create a (lowercase only) folder for your new platform, next to the existing photoshop, illustrator and indesign folders.

Then, copy the scriptplatform.py and comment.py files from one of the existing platforms.

There are three key functions in the class in scriptplatform.py...

class ScriptPlatformScriptGen:
    
    def __init__(self):     
        # Usually nothing much needed here.
        pass    

    def GenerateScriptStart(self):        
        # Begin the script
        Script = "var filePath = app.activeDocument.fullName.path;\r\n"        
        return Script
        
    def GenerateCardEnd(self, sheet, row):
        # Finish generating each individual card
        Script = 'app.jpegExportPreferences.exportResolution = 300;app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.HIGH;\n'
        Script += 'var savePath = File(filePath + "/' + sheet.cell_value(row,0).replace(".","") + '.jpg");app.activeDocument.exportFile(ExportFormat.JPG, savePath,false);\n'
        return Script
    
    def GenerateScriptEnd(self):
        # Finish generating the whole file
        return "app.activeDocument.close(SaveOptions.no);\r\n"

GenerateScriptStart is called to create the opening lines of your script and perform any initialisation you need.

GenerateCardEnd saves each card to a suitable location.

GenerateScriptEnd adds the scripting to clean up and close any documents.