Skip to main content
Inspiring
Apr 11, 2019 2:05 PM UTC
Answered

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

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

Thanks

This topic is closed to new replies. Start a new post to keep the conversation going.
sharp_idea16B8
sharp_idea16B8Correct answer
Adobe Employee
Apr 12, 2019 7:06 AM UTC


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`?

14 replies

kerrishotts
Participating Frequently
Apr 11, 2019 3:50 PM UTC

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.

Translate
Inspiring
Apr 11, 2019 5:31 PM UTC

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.

Translate
sharp_idea16B8
Adobe Employee
Adobe Employee
Apr 12, 2019 5:32 AM UTC

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.

Translate
Community Expert
Apr 11, 2019 2:25 PM UTC

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

Translate