Skip to main content
Inspiring
February 9, 2023
Answered

Chat GPT

  • February 9, 2023
  • 1 reply
  • 8286 views

So someone was impressed with Chat GPT, so I asked if it can write scripts in JavaScript, sure enough it spit out this. Learning curve put aside for now 😊

This topic has been closed for replies.
Correct answer Stephen Marsh
quote

I've been meaning to try that myself.

 

Does the script actually work in photoshop?

 

Did you have to specify that the script was for photoshop?


By @Jeff Arola

 

Yes, it works:

 

var layer = app.activeDocument.artLayers.add();
layer.name = "Healing";
var groups = app.activeDocument.layerSets;
for (var i = 0; i < groups.length; i++) {
    if (groups[i].name === "Repair") {
        layer.move(groups[i], ElementPlacement.INSIDE);
        break;
    }
}

 

We have had a few people posting failed ChatGPT code here of late, this is the first one that I recall that actually works!

 

Of course, it would all depend on how the phrase/instructions are input and perhaps if there were multiple iterations to "tighten things up".

 

I too would have thought that the keywords of "Photoshop" or "ExtendScript" etc. would be required, however, the screenshot appears to show otherwise.

 

It is early days for such tools.

 

1 reply

Jeff Arola
Community Expert
Community Expert
February 9, 2023

I've been meaning to try that myself.

 

Does the script actually work in photoshop?

 

Did you have to specify that the script was for photoshop?

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
February 9, 2023
quote

I've been meaning to try that myself.

 

Does the script actually work in photoshop?

 

Did you have to specify that the script was for photoshop?


By @Jeff Arola

 

Yes, it works:

 

var layer = app.activeDocument.artLayers.add();
layer.name = "Healing";
var groups = app.activeDocument.layerSets;
for (var i = 0; i < groups.length; i++) {
    if (groups[i].name === "Repair") {
        layer.move(groups[i], ElementPlacement.INSIDE);
        break;
    }
}

 

We have had a few people posting failed ChatGPT code here of late, this is the first one that I recall that actually works!

 

Of course, it would all depend on how the phrase/instructions are input and perhaps if there were multiple iterations to "tighten things up".

 

I too would have thought that the keywords of "Photoshop" or "ExtendScript" etc. would be required, however, the screenshot appears to show otherwise.

 

It is early days for such tools.