Skip to main content
Inspiring
April 11, 2019
Answered

$.writeln output to VS Code Editor -- how?

  • April 11, 2019
  • 2 replies
  • 5598 views

Is there someway to have a script's $.writeln output show up in VS Code instead of the ESTK?

Thanks

This topic has been closed for replies.
Correct answer sharp_idea16B8


I suspect the problem is with targetSpecifier. Can you try following:

1. Remove targetSpecifier and engineName from launch.json

2. Select Indesign target and engine from `Select the target application` at the status bar in the bottom.

After selecting the target and starting the script, in the Output window, what is the value of `targetSpecifier`?

2 replies

kerrishotts
Adobe Employee
Adobe Employee
April 11, 2019

Can you share what you're seeing when you try to use $.writeln? Does ESTK launch, or do you just see nothing in the output of VSCode?

Also -- there is an issue where the last write may not show up in the output -- so make sure you're executing more than one $.writeln.

Finally -- try the 1.0.1 release of the plugin (release is in progress; should be on the marketplace in a few minutes) and see if anything improves.

Inspiring
April 11, 2019

Haven't been able to get it working. (OSx, VSC 1.33.1, 1.0.1 plugin)

Uninstalled and reinstalled the plugin

1) The setup instructions don't work -- when I click the plugin gear I get

{

   // Use IntelliSense to learn about possible attributes.

   // Hover to view descriptions of existing attributes.

   // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387

   "version": "0.2.0",

   "configurations": [

 

  {

   "type": "node",

   "request": "launch",

   "name": "Launch Program",

   "program": "${file}"

  }

  ]

}

Which is not what the instructions say should be there.

I replace that with the contents from the install instruction == try to run -- and get

Can’t start a session without an active target and engine. Select an active target and engine before trying again.

I add

"targetSpecifier": "inDesign-14.0-ME",

   "engineName":"main",

and it starts ID

And gives an error: TypeError: Cannot read property 'label' of undefined

I've been running scripts from inside ID and getting the $.writeln output in the ESTK for now -- but want to get it working.

sharp_idea16B8
Adobe Employee
Adobe Employee
April 12, 2019

May be there is some syntax error in your script. Can you try with a sample script(`alert("Hello World");`) first and see if that works? Also in the configuration, ` "program": "${file}"` means that your currently focussed script(.js/.jsx) in the editor window will be executed.

Community Expert
April 11, 2019

Hi akiva_atwood ,

from a similar question on InDesign Scripting Forum I know that you are on Mac OS X.

What's your version of VS Code Editor?

If you are executing a $.writeln() what exactly will happen?
Does the ESTK try to launch? Thought, the ESTK cannot run side-by-side with VS Code Editor.

Could you avoid using $.writeln() and switch to a different messaging system?

Write e.g. the result of the argument with toString() to a log file and execute the log after ExtendScript script run.

Regards,
Uwe