Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to import data group txt file and export data group as file #326

Open
benjamenhe opened this issue Dec 5, 2023 · 0 comments
Open

How to import data group txt file and export data group as file #326

benjamenhe opened this issue Dec 5, 2023 · 0 comments

Comments

@benjamenhe
Copy link

Hello.
I need to use photoshop's import data group and export data group api, but I can't find this, I have an error in photoshop js code writing.
Can you help me ? Many thanks

My code:
with Session(action="new_document") as ps:

ps.app.load(psd_path)

Import a dataset from a text file

ps.app.activeDocument.importDataSets(data_path, eraseAll=True)

Export the dataset with specific file naming rules

    file_naming_rules = [
        constants.FileNamingComponent.NONE,
        constants.FileNamingComponent.DATASET_NAME,
        constants.FileNamingComponent.NONE,
        constants.FileNamingComponent.NONE,
        constants.FileNamingComponent.NONE,
        constants.FileNamingComponent.NONE,
        constants.FileNamingComponent.LOWERCASE_EXTENSION,
    ]

    ps.app.activeDocument.exportDataSets(export_folder, fileNamingRules=file_naming_rules)

Code error:
NameError: Name importDataSets not found
AttributeError: module 'photoshop.api.constants' has no attribute 'FileNamingComponent'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant