Skip to main content
Participant
January 1, 2024
Answered

ExtendScript Debugger Visual Studio Code Link to Photoshop App

  • January 1, 2024
  • 2 replies
  • 1149 views

I am trying out scripting Photoshop, I am experienced using Visual Studio but not the code version, I have also written in Javascript many times but the environment around using VS Code and the ExtendScript Debugger is causing me issues.  I'm using ExtendScript Debugger with VS Code 1.85.1, running under Windows 10.  I've run scripts directly from Photoshop and they have worked, however, I want to use the debugger running in Visual Studio Code and have been following tutorials from various sources. I'm just testing to see that I can link to Photoshop and get some basic information back about layers. The following is my code so far:

main();
function main(){
   alert("Hello");
   var doc=app.activedocument;
   var myWindow = new Window("palette","My Window",undefined);
   myWindow.orientation="row";

This launches ok and pops up an alert window in Photoshop. But is then should pop up a window but doesn't. There are no errors, however, intellisense does not have app and the code app.activedocument appears to be ignored. I have also not been able to find myWindow.show() which I think is what will display to window. Possibly I have missed a step in setting up VS Code.

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

Basic error, JS/ES is case-sensitive, camelCase:

 

var doc=app.activedocument;

 

 

var doc=app.activeDocument;

 

 

2 replies

Stephen Marsh
Community Expert
Community Expert
January 2, 2024

Consider Photoshop's support of

 

new Window("palette"

 

vs.

 

new Window("dialog"

 

https://creativepro.com/files/kahrel/indesign/scriptui.html

 

https://extendscript.docsforadobe.dev/user-interface-tools/window-object.html

 

The window type. The value is:

  • dialog - Creates a modal dialog.

  • palette - Creates a modeless dialog, also called a floating palette. (Not supported by Photoshop CC.)

  • window - Creates a simple window that can be used as a main window for an application. (Not supported by Photoshop CC.)

 

https://indd.adobe.com/view/a0207571-ff5b-4bbf-a540-07079bd21d75

 

https://www.davidebarranca.com/2012/10/scriptui-window-in-photoshop-palette-vs-dialog/

 

 

EDIT: I would forget about ScriptUI windows for the moment, just concentrate on basic scripting first, adding the legacy ScriptUI code into the mix is going to seriously complicate your early learning.

Legend
January 2, 2024

Yep, palette will popup a window that vanishes. Use dialog type for a floating window in Photoshop.

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
January 2, 2024

Basic error, JS/ES is case-sensitive, camelCase:

 

var doc=app.activedocument;

 

 

var doc=app.activeDocument;