nArtLayers = len([ (i, x) for i, x in enumerate(docRef.LayerSets[nLayerSets].ArtLayers, 1) ]) active_layer = docRef.ActiveLayer = docRef.LayerSets[nLayerSets].ArtLayers[ nArtLayers] # print(docRef.ActiveLayer.Name) psReplaceSelection = 1 # from enum PsSelectionType # # sel_area argument not accepted if using win32com, using comtypes instead sel_area = ((0, 212), (300, 212), (300, 300), (0, 300)) docRef.Selection.Select(sel_area, psReplaceSelection, 20, True) psGaussianNoise = 2 # from enum PsNoiseDistribution active_layer.ApplyAddNoise(15, psGaussianNoise, False) backColor = CreateObject("Photoshop.SolidColor") backColor.HSB.Hue = 0 backColor.HSB.Saturation = 0 backColor.HSB.Brightness = 100 app.BackgroundColor = backColor sel_area2 = ((120, 20), (210, 20), (210, 110), (120, 110)) docRef.Selection.Select(sel_area2, psReplaceSelection, 25, False) active_layer.ApplyDiffuseGlow(9, 12, 15) psTinyLensTexture = 4 # from enum PsTextureType active_layer.ApplyGlassEffect(7, 3, 7, False, psTinyLensTexture, None) docRef.Selection.Deselect() # Set ruler units back the way we found it if strtRulerUnits is not psPixels: app.Preferences.RulerUnits = strtRulerUnits