Skip to main content
rob day
Community Expert
Community Expert
June 24, 2022
Answered

#targetengine not working in VSC

  • June 24, 2022
  • 2 replies
  • 408 views

Hi All, I’m having a problem with event scripts that need a target engine in Visual Studio Code with the latest ExtendScript Debugger 2.02. I get an error running out of Code but not when I run from the Scripts panel.

This:

#targetengine "session";
main();

function main(){
    app.eventListeners.add("beforeExport", onExport );
}

/**
* Function to run before an Export
* @ param the event 
*/
function onExport(e){
    alert("Hello")
}

 

Throws this error running from VSC:

 

 

I have a feeling the problem might be with my JSON launch code, which is this—do I need something different for engineName?:

 

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "ExtendScript debug", 
      "type": "extendscript-debug",
      "request": "launch", //"launch" or "attach"
      "hostAppSpecifier": "indesign",
      "engineName": "main",
    }
  ]
}

 

This topic has been closed for replies.
Correct answer rob day

I should have tried before posting setting engineName to "session" seems to work.

2 replies

Kasyan Servetsky
Legend
June 25, 2022

Kris Coppieters recommends replacing ‘#’ for directives with ‘//@’:
#targetengine -> //@targetengine

 

rob day
Community Expert
rob dayCommunity ExpertAuthorCorrect answer
Community Expert
June 24, 2022

I should have tried before posting setting engineName to "session" seems to work.