Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Refresh values from Illustrator

Participant ,
Nov 16, 2018 Nov 16, 2018

Hello, hello

I'm learning scripting for Illustrator and Script UI and I have 2 problems but I will separate this 2 problems in 2 differents posts.

It's first problem.

I use ExtendScript Toolkit to test my scipt in Illustrator, I created a window catch a value from path item in illustrator.

This value is pathItem.top ("y" in info panel - on illustrator).

In my window, I have 2 controls : 1 edit text and 1 button.

When I click on button, script catch value (pathItem.top) and put it in edit text (in window).

01.PNG

Problem : When I move path Item in illusrtator with cursor, script can't give me new value (pathItem.top), he keep old value (script is "freezen").

Sometimes, script give me new value but I have move path Item in illustrator with transformation panel in illustrator.

I recorded a little movie from my computer to show you it, I give you link from Youtube (if you have a problem, tell me) : Refresh info from Illustrator - forum Illustrator Scripting - YouTube

My code is in end of this post, if you want I can send you file .jsx.

Can you give me your help, please.

Aaah and sorry for my bad english, I try to write good message to ask help, thank you, thank you.

-------------------------------------------------------------------------

My code is :

#target illustrator

var palette01 = 'palette\

{text: "Ma fenêtre",\

    ed1: EditText{characters: 20},\

    b1: Button{text: "Afficher les valeurs"},\

}';

var maFenetre = new Window(palette01);

var editTextPalette = maFenetre.ed1;

var button01Palette = maFenetre.b1;

var monDoc = app.activeDocument;

var monCalque = monDoc.layers["coucou"];

var atrace01 = monCalque.pathItems["01"];

var messagePalette01 = 'function aa()\

{\

    var valeur;\

    valeur = atrace01.position;\

    editTextPalette.text = valeur;\

    alert("Ca marche !")\

};\

aa()';

var aaPalette01 = new BridgeTalk;

aaPalette01.target = BridgeTalk.appName;

aaPalette01.body = messagePalette01;

button01Palette.onClick = function(){aaPalette01.send()};

maFenetre.show();

Ce message a été modifié par : Steven Charles-Charlery

TOPICS
Scripting
1.5K
Translate
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

correct answers 1 Correct answer

Community Expert , Nov 17, 2018 Nov 17, 2018

the reference to your object needs to be inside the function you're sending through BridgeTalk. The reference needs to be recreated everytime you click the button.

I changed it to report selected object's position

#target illustrator

var palette01 = "palette \

{text: 'Ma fenêtre', \

    ed1: EditText{characters: 20}, \

    b1: Button{text: 'Afficher les valeurs'}, \

}";

var maFenetre = new Window(palette01);

var editTextPalette = maFenetre.ed1;

var button01Palette = maFenetre.b1;

var monDoc = app.activeDoc

...
Translate
Adobe
Community Expert ,
Nov 16, 2018 Nov 16, 2018

Unfortunately, Illustrator's JavaScript doesn't support such events and we can't get the correct value like your case.

If you are familiar about C++, You can make a plugin with Illustrator SDK that supports selectionChanged event.

Below article was written by Japanese. However, You can translate and reference it.

notifierの設定 | CC Labo

Translate
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
Participant ,
Nov 17, 2018 Nov 17, 2018

Oooh ok, if I learn HTML panel (HTML5, css3 and js) for Illustrator (CEP), i Can get correct value ?

Or I have learn C++ ?

Thank you

Translate
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
Community Expert ,
Nov 17, 2018 Nov 17, 2018

the reference to your object needs to be inside the function you're sending through BridgeTalk. The reference needs to be recreated everytime you click the button.

I changed it to report selected object's position

#target illustrator

var palette01 = "palette \

{text: 'Ma fenêtre', \

    ed1: EditText{characters: 20}, \

    b1: Button{text: 'Afficher les valeurs'}, \

}";

var maFenetre = new Window(palette01);

var editTextPalette = maFenetre.ed1;

var button01Palette = maFenetre.b1;

var monDoc = app.activeDocument;

//var monCalque = monDoc.layers["coucou"];

//var atrace01 = monCalque.pathItems["01"];

var messagePalette01 = "function aa()\

{\

    var valeur;\

    var atrace01 = selection[0];\

    valeur = atrace01.position;\

    editTextPalette.text = valeur;\

    //alert('Ca marche !')\

};\

aa()";

var aaPalette01 = new BridgeTalk;

aaPalette01.target = BridgeTalk.appName;

aaPalette01.body = messagePalette01;

button01Palette.onClick = function(){aaPalette01.send()};

maFenetre.show();

Translate
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
Participant ,
Nov 18, 2018 Nov 18, 2018

Oh thank you, I will use this snippet and I will give you news about it

Translate
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
Participant ,
Nov 18, 2018 Nov 18, 2018
LATEST

It's ok, it's good, thank you.

I don't saw this information in doc about BridgeTalk.

Translate
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