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

how to use events to invoke a javascript function?

New Here ,
Jun 13, 2019 Jun 13, 2019

Goodmorning everyone,

not having experience with scripts, I immediately stopped trying to do this simple script that updates the size of the equation after correcting it.

var myEventNames = ["afterSelectionAttributeChanged"];

function RIDIMENSIONA() {

app.selection[0].graphics[0].verticalScale=100;

app.selection[0].graphics[0].horizontalScale=100;

app.selection[0].graphics[0].fit(FitOptions.FRAME_TO_CONTENT);

}

app.addEventListener(myEventNames[0], RIDIMENSIONA);

app.selection[0].graphics[0].itemLink.editOriginal();

after correcting the equation in indesign I get the message I am attaching.

I imagine that everything depends on my poor knowledge of the subject.

thanks for the help

ivan

TOPICS
Scripting
656
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 , Jun 13, 2019 Jun 13, 2019

The question is not clear, do you get the error message stating something on the lines "the object no longer exists". If so add the following line at the top of your script file

#targetengine myengine

This will create a persistent space where your script runs and hence the eventhandler that you are adding persists even after the script execution is finished.

-Manan

Translate
Community Expert ,
Jun 13, 2019 Jun 13, 2019

The question is not clear, do you get the error message stating something on the lines "the object no longer exists". If so add the following line at the top of your script file

#targetengine myengine

This will create a persistent space where your script runs and hence the eventhandler that you are adding persists even after the script execution is finished.

-Manan

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
New Here ,
Jun 13, 2019 Jun 13, 2019
LATEST

many thanks for the prompt and resolute reply

Hello

ivan

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