Skip to main content
rcraighead
Legend
August 19, 2020
Answered

How to edit "launch.json" file in VSC (Visual Studio Code) to automatically run current file in AI?

  • August 19, 2020
  • 1 reply
  • 2673 views

I am moving to VSC for ExtendScript development and have a question about the "launch.json". I read that it can be edited to target a specific application when running a script. But I can't find instructions for "How" to do that.

 

    "version": "0.2.0",
    "configurations": [

        {
            "type": "extendscript-debug",
            "request": "launch",
            "name": "Launch Program",
            "program": "${file}",
            "stopOnEntry": false
        },
    ]
}

 

The above "launch.json" will run the current file to Illustrator as long as AI has been selected from the "Target Apps" list at the bottom of VSC. Problem is this selection is lost between sessions and I ONLY develop for AI (right now). 

Note: There is no "JSON" code option in the "Format Code" feature in this forum.

This topic has been closed for replies.
Correct answer m1b

Hi, use "targetSpecifier". This is what I use for a simple case of "debug the file I'm editing right now":

 

{
    "type": "extendscript-debug",
    "request": "launch",
    "name": "Debug current file",
    "program": "${file}",
    "targetSpecifier": "illustrator-24.064"
}

 

You can find the version of Illustrator by doing app.version, and taking the main version number (24 for me) and adding 0.64 for 64 bit. I haven't done this with many versions, and only on Mac,  so I don't know how robust this method is.

1 reply

m1b
Community Expert
m1bCommunity ExpertCorrect answer
Community Expert
August 19, 2020

Hi, use "targetSpecifier". This is what I use for a simple case of "debug the file I'm editing right now":

 

{
    "type": "extendscript-debug",
    "request": "launch",
    "name": "Debug current file",
    "program": "${file}",
    "targetSpecifier": "illustrator-24.064"
}

 

You can find the version of Illustrator by doing app.version, and taking the main version number (24 for me) and adding 0.64 for 64 bit. I haven't done this with many versions, and only on Mac,  so I don't know how robust this method is.

rcraighead
Legend
August 20, 2020

Hey, that works! Thanks for the help.

m1b
Community Expert
Community Expert
August 20, 2020

You're welcome!