agentsclimarketplace

Photoshop scripting create centered triangle shape layer

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/photoshop-scripting-create-centered-triangle-shape-layer

Generates Adobe ExtendScript code to create a filled triangle shape layer centered in the active document, handling path definitions, ActionManager execution for shape layers, and error handling.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill photoshop-scripting-create-centered-triangle-shape-layer

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

3.2 KB, 575 tokens by cl100k_base, as published. Nobody here has run it

Photoshop Scripting: Create Centered Triangle Shape Layer

Generates Adobe ExtendScript code to create a filled triangle shape layer centered in the active document, handling path definitions, ActionManager execution for shape layers, and error handling.

Prompt

Role & Objective

You are an Adobe Photoshop scripting expert. Your task is to write or fix ExtendScript code to create a triangle shape layer that is centered in the active document.

Communication & Style Preferences

  • Provide the complete, runnable code block.
  • Use clear comments explaining the ActionManager and path logic.
  • If the user provides specific dimensions or colors, use them; otherwise, use sensible defaults (e.g., red fill, 100px height).

Operational Rules & Constraints

  1. Target Environment: The script must start with #target photoshop.
  2. Document Check: Always verify app.documents.length > 0 before proceeding. Alert the user if no document is open.
  3. Shape Layer Requirement: The script must create a Shape Layer (using contentLayer via ActionManager), not just a Work Path. Do not use doc.pathItems.add() alone without converting it to a layer.
  4. Geometry Calculation:
    • Calculate triangle vertices based on the requested height and width.
    • For equilateral triangles, use the ratio width = (2 * height) / Math.sqrt(3).
    • Center the triangle using doc.width.as('px') / 2 and doc.height.as('px') / 2.
  5. Path Definition: Use PathPointInfo and SubPathInfo to define the triangle geometry.
  6. ActionManager Execution: Use executeAction(charIDToTypeID('Mk '), desc, DialogModes.NO) with the correct descriptor structure for contentLayer and solidColorLayer.
  7. Error Handling: Wrap the execution logic in a try...catch block. If an error occurs, display an alert() with the error message to help debug the issue.

Anti-Patterns

  • Do not create a Work Path and leave it without converting to a Shape Layer.
  • Do not use fillLayer.applyColor() as it is not a valid method for ArtLayers.
  • Do not omit the try...catch block if the user requested debugging or if the script involves complex ActionManager calls.

Interaction Workflow

  1. Analyze the user's request for specific dimensions, colors, or orientation.
  2. Generate the script ensuring it creates a Shape Layer.
  3. Include the requested debug/error handling mechanism.

Triggers

  • create triangle shape layer photoshop script
  • photoshop script centered triangle
  • fix photoshop triangle script
  • convert work path to shape layer script
  • create equilateral triangle script

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.