Skip to main content
Known Participant
March 2, 2018
Question

script for print (show) text of text frame on the alert

  • March 2, 2018
  • 3 replies
  • 2214 views

hi .

i want script for copy text of text frame  and print text frame in alert.

how select All characters in the text frame.

This topic has been closed for replies.

3 replies

Community Expert
August 25, 2022

Hi @ashish25786013lca1 ,

did you try my suggestion from March 2018?

A variation on this:

// ExtendScript (JavaScript) code
// Let's pretend the text frame is selected by the user:

var textFrame = app.selection[0];
var textOfTextFrame = textFrame.texts[0];
// Select the text, not the text frame:
textOfTextFrame.select();
// Copy the selected text to the clipboard:
app.copy();
// Alert the contents of the text:
alert( textOfTextFrame.contents );

 

Did I miss something?

@shahriara7551080 wasn't very clear what the script should do.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Community Expert
March 2, 2018

Hi shahriara7551080 ,

how do you like to address your text frame in the document?

Do you like to select the text frame? Or do you know that there is only one text frame in the document? Or on a distinct page? Or does it have a special name or a label…?

Whatever you do to reach the text frame, assign it to a variable.

Let's pretend the variable name is simply textFrame, then you could alert the contents like that using ExtendScript (JavaScript):

// Let's pretend the text frame is selected by the user:

var textFrame = app.selection[0];

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

You really should ask scripting questions here:

InDesign Scripting

Regards,
Uwe

Ten A
Community Expert
Community Expert
March 2, 2018

This thread moved from InDesign to InDesign Scripting.

Thank you for notify Laubender.

vladan saveljic
Inspiring
March 2, 2018

you should ask it here

InDesign Scripting