New to Coding and need help getting started


I work a lot with Photoshop and I decided to jump into the “fun” world of coding to try and automate some of the work I do.

Now please bear with me as I’ve never really coded anything in my life.

To get started I created my first plugin using the starting template, which is a simple button to create a new document with a new text layer saying “Hello Photoshop!”

However, when I click the button nothing happens. I’m sure I’m doing something fundamentally wrong but as I’m a beginner I’m struggling to figure out what exactly.

Any help would be great.

Here’s the code

const { entrypoints } = require("uxp");

  showAlert = () => {
    alert("This is an alert message");

    commands: {
    panels: {
      vanilla: {
        show(node ) {

  function createNewDocument() {
    const app = require('photoshop').app;
    document = app.documents.add(50, 50, 72, "helloPhotoshop");
    let layer = document.artLayers.add()
    layer.kind = LayerKind.TEXT;
    layer.textItem.contents = "Hello Photoshop!";
    layer.textItem.size = 50;

  document.getElementById("btnNewdocument").addEventListener("click", createNewDocument);
<!DOCTYPE html>
    <script src="main.js"></script> 
    <link rel="stylesheet" href="style.css">   
  <sp-heading>Create New Doc</sp-heading>
    <sp-button id="btnNewdocument">New</sp-button>


An error message I got.

I think you could start here: JavaScript Variables

1 Like

Thanks Jarda,

Yeah I’m currently running through this site.

A bit to go yet.

Currently running through this too -

1 Like

Yes, I think those 51 hours are reasonable before you start to learn UXP. Also in your case you would better start with scripts instead of plugins as it requires less code. Also in Developer Tools there is playground and you can try some snippets.