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

how using script variable in c#?

Community Beginner ,
Mar 02, 2018 Mar 02, 2018

Copy link to clipboard

Copied

i want  script variable To assign variable in c#. in this code i want variable x in script To assign lable1.text .:

            string copy = string.Format(@"

var textFrame = app.selection[0]; 

//alert( textFrame.texts[0].contents );

x=textFrame.texts[0].contents ;    -----> i want use this variable in c# .

alert(x);

");

           

            InDesign.Application InDesignApp = (InDesign.Application)Activator.CreateInstance(Type.GetTypeFromProgID("InDesign.Application"));

            InDesignApp.Activate();

            InDesignApp.DoScript(copy, InDesign.idScriptLanguage.idJavascript);

  pleas help me .

TOPICS
Scripting

Views

1.1K

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

correct answers 1 Correct answer

Enthusiast , Mar 06, 2018 Mar 06, 2018

Sorry for the typo,

replace the first line with : app.scriptArgs.setValue("x", textFrame.texts[0].contents);

Votes

Translate

Translate
Enthusiast ,
Mar 02, 2018 Mar 02, 2018

Copy link to clipboard

Copied

Try this,

In js,

     app.scriptArgs.setValue("x", "textFrame.texts[0].contents");

In c#

     Console.WriteLine(InDesignApp.ScriptArgs.GetValue("x"));

Regards,

Chinna

Votes

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
Community Beginner ,
Mar 03, 2018 Mar 03, 2018

Copy link to clipboard

Copied

this is printing "textFrame.texts[0].contents". !!!!!

i want print content of "textFrame.texts[0].contents".

pleas help me .

Votes

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
People's Champ ,
Mar 05, 2018 Mar 05, 2018

Copy link to clipboard

Copied

It's just a minor typo Chinnadk​ made when he tried to HELP you. At least, you may be grateful.

I could help you fix that typo but I will choose to let you deal with it.

Votes

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
Community Beginner ,
Mar 05, 2018 Mar 05, 2018

Copy link to clipboard

Copied

pleas help me .

Votes

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
Enthusiast ,
Mar 06, 2018 Mar 06, 2018

Copy link to clipboard

Copied

LATEST

Sorry for the typo,

replace the first line with : app.scriptArgs.setValue("x", textFrame.texts[0].contents);

Votes

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