Skip to main content
Inspiring
December 21, 2023
Answered

[Q] JSON in VSCODE to automatically bring Illustrator to front?

  • December 21, 2023
  • 1 reply
  • 1058 views

I seem to remember that there was a trick to automatically make illustrator the front application when running an ExtendScript from VSCode but I can't figure it out anymore.

 

A screenshot of my launch.json file is attached. I'm on MacOS.

 

I use F5 to run the script. It runs fine, Illustrator does its thing but stays in the background.

 

Any help greatly appreciated.

 

// Tom

 

This topic has been closed for replies.
Correct answer m1b

This is just for info: I noticed you are using the "launch" request type. I have my usual launch.json configuration set up as "attach" request type, which means that it will "attach" to the host (eg. Illustrator) and stay attached until you stop it. This makes running scripts faster because it doesn't have to attach *every* time you run a script.

 

This is my usual launch.json configuration for Illustrator:

{
    "type": "extendscript-debug",
    "request": "attach",
    "name": "Attach--transient",
    "hostAppSpecifier": "illustrator-28.064",
    "engineName": "transient",
    "hiddenTypes": [
        "builtin",
    ],
},

 - Mark

1 reply

m1b
Community Expert
December 21, 2023

Hi @tomd75724979, I put this:

{
    "key": "cmd+r",
    "command": "extension.extendscript-debug.evalInAttachedHost",
    "args": {
        "debugLevel": 1,
        "bringToFront": false
    }
},
{
    "key": "cmd+shift+r",
    "command": "extension.extendscript-debug.evalInAttachedHost",
    "args": {
        "debugLevel": 1,
        "bringToFront": true
    }
},

in my keybindings.json.

 

This is great for me because I can do either way. Of course you don't have to change the keybinding from what you prefer.

- Mark 

m1b
m1bCorrect answer
Community Expert
December 21, 2023

This is just for info: I noticed you are using the "launch" request type. I have my usual launch.json configuration set up as "attach" request type, which means that it will "attach" to the host (eg. Illustrator) and stay attached until you stop it. This makes running scripts faster because it doesn't have to attach *every* time you run a script.

 

This is my usual launch.json configuration for Illustrator:

{
    "type": "extendscript-debug",
    "request": "attach",
    "name": "Attach--transient",
    "hostAppSpecifier": "illustrator-28.064",
    "engineName": "transient",
    "hiddenTypes": [
        "builtin",
    ],
},

 - Mark

Inspiring
December 22, 2023

Great stuff, Mark, thank you so much! I think I'm starting to understand: first you have to be attached to the host, only then you can actually run the code?

 

I still have one hick-up: it only works for me if the "engineName" is set to "main". If I set it to "transient" I get an error. See screenshot. Do I need to install this transient engine? Enable it? What is the difference anyway between "main" and "transient"?