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

app.documents.getByName Appears Broken? #162

Closed
Investigamer opened this issue Jul 9, 2022 · 5 comments
Closed

app.documents.getByName Appears Broken? #162

Investigamer opened this issue Jul 9, 2022 · 5 comments

Comments

@Investigamer
Copy link
Contributor

Describe the bug
app.documents.getByName does not appear to work, raises an error that "name getByName not found"

To Reproduce

app = ps.Application()
document = app.documents.getByName("my-document-name.psd")
print(document)
# Will raise an error

Expected behavior
Find and retrieve the document object by its name

Desktop (please complete the following information):

  • OS: Windows 10
  • Photoshop Version: Photoshop 2022
  • Python Version: python-3.8.x

Screenshot
image
image

@loonghao
Copy link
Owner

@MrTeferi I will fix this soon.
There are many functions that may be inconsistent with the Photoshop javascript API after binding through COM, we need to patch them manually, I will create a new MR to fix this, thank you for your report.

@loonghao
Copy link
Owner

@MrTeferi
I have deployed a new version, please try again,
cheers.

@Investigamer
Copy link
Contributor Author

Investigamer commented Jul 31, 2022

@loonghao Thanks Hal can confirm this definitely works for me now! Cheers buddy
Also we miss you on the discord group ;)

@horiebin
Copy link

the problem appears again
layer = doc.artLayers.getByName("background")

KeyError: ('exportDocument', 3)

windows10
photoshop 2020
python 3.6

@Investigamer
Copy link
Contributor Author

the problem appears again layer = doc.artLayers.getByName("background")

KeyError: ('exportDocument', 3)

windows10 photoshop 2020 python 3.6

I'll look into this using latest version when I get the chance. In the meantime, please post full code snippet. BTW, if I'm not mistaken you can now also get layers using dict key notation like this:

layer = doc.artLayers['Layer Name']

Also keep in mind that accessing a layer via artLayers only works for layers, not layer groups. For layer groups you have to use layerSets like so:

layer = doc.layerSets['Layer Group Name']

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

3 participants