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 .
Sorry for the typo,
replace the first line with : app.scriptArgs.setValue("x", textFrame.texts[0].contents);
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
Copy link to clipboard
Copied
this is printing "textFrame.texts[0].contents". !!!!!
i want print content of "textFrame.texts[0].contents".
pleas help me .
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.
Copy link to clipboard
Copied
pleas help me .
Copy link to clipboard
Copied
Sorry for the typo,
replace the first line with : app.scriptArgs.setValue("x", textFrame.texts[0].contents);