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

TypeError: 'Layers' object is not subscriptable #18

Open
MFRS opened this issue Sep 30, 2022 · 1 comment
Open

TypeError: 'Layers' object is not subscriptable #18

MFRS opened this issue Sep 30, 2022 · 1 comment

Comments

@MFRS
Copy link

MFRS commented Sep 30, 2022

I cannot select a layer, this is my code

` import win32com.client as win32
import os
from comtypes.client import GetActiveObject, CreateObject

try:
adobe_app = win32.GetActiveObject("Photoshop.Application")
except:
adobe_app = win32.gencache.EnsureDispatch('Photoshop.Application')
try:
# cd = adobe_app.Open(filepath)
cd = adobe_app.ActiveDocument
except:
cd = adobe_app.ActiveDocument
# cd = adobe_app.ActiveDocument
currentTextLayer = cd.Layers[0]
print(currentTextLayer)

`

Any suggestions?

@adepierre
Copy link

Just got the same error. I solved it by replacing Layers['name'] by Layers.Item('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

2 participants