AI Object attribute/ method tips in VS Code

Contributor ,
Jul 29, 2022 Jul 29, 2022

Copy link to clipboard

Copied

Hello,

 

I am a novice in illustrator script. Now I try to write JS with VS Code, but the properties and methods of AI objects are very troublesome to me. How can I have property and method prompts when writing JS with VS Code? It's like writing VBA in VBE.

 

Any other suggestions, I am very grateful!

 

Object attribute/ method tips in VBE

RaymondZJH_0-1648091683056.png

TOPICS
Scripting

Views

96

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 29, 2022 Jul 29, 2022

Copy link to clipboard

Copied

Hi @Raymond ZJH,

Checkout this project

https://github.com/aenhancers/Types-for-Adobe

Also, if you choose not to write TS but regular js, these type definitions are reported to still work as per the discussion mentioned below

https://community.adobe.com/t5/illustrator-discussions/jsdoc-for-illustrator-vscode/m-p/11831850

-Manan

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 30, 2022 Jul 30, 2022

Copy link to clipboard

Copied

Hi @Manan Joshi 

First of all, thank you for your quick reply!

It seems that this is a very complicated thing. I can't understand it at all, and I don't know how to download this index.d.ts file and open it in vs code. I'm not a professional programmer. I only write some JS at ordinary times. I don't know whether there are simple steps 1, 2 and 3.... to realize this function?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 30, 2022 Jul 30, 2022

Copy link to clipboard

Copied

Did you see the video on the github link? That shows the steps you need to take. Also the commands under Your first script for eg. Adobe Illustrator lists all the commands that you need to execute in order to set things up.

-Manan

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 01, 2022 Aug 01, 2022

Copy link to clipboard

Copied

Hi @Manan Joshi 

I watched this video several times, but I still didn't understand it. I'm very ashamed and confused, but thank you!

I don't know where to start first.....

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Aug 01, 2022 Aug 01, 2022

Copy link to clipboard

Copied

  • Open the terminal application your MAC. It is an application that is used to run commands, you might have used it. You can open it by typing terminal in Spotlight

After you open the terminal you run the following commands as mentioned in the Github repo. One after the other. The lines starting with # are just comments to tell you what is being done by the commands that follow, so they need to be ignored. Copy them and paste in terminal one by one and press enter.

# create new folder
mkdir my-script
cd my-script

# install types-for-adobe
npm init -y
npm i types-for-adobe

# create tsconfig.json
printf '{"compilerOptions":{"module":"none","noLib":true}}' > tsconfig.json

# create index.ts and change reference types to Adobe product you're targeting
printf '/// <reference types="types-for-adobe/Illustrator/2015.3"/>\nalert(String(app));\n' > index.ts

# compile typescript files
tsc

# open Adobe Illustrator -> File -> Scripts -> Other Script -> and open index.js

Let me know if you still have issues.

 -Manan

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

Thank you for your patient reply. Maybe I need to learn more how to start on the official website of vs Code....

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 12, 2022 Aug 12, 2022

Copy link to clipboard

Copied

LATEST

Hi @Manan Joshi 

Vs code is really a professional software, so far I have not understood how it is used! It seems that it needs to do some configuration files first, but I don't know where to start. I don't even know how to judge whether I have successfully installed node.js and typescript and git, and how they are installed.
An error occurred while running "npm init -y" according to your method. I wonder if these two files are not installed?

捕获.JPG
I just use VS Code to write illustrator JS. Can you briefly explain the process from opening VS code software to writing JS step by step? It would be better if you could attach pictures. Thank you very much for your patience!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines