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

fill with place holder text

Engaged ,
Jan 15, 2016 Jan 15, 2016

Does anyone know if Fill with placeholder text is accessible through javascript or applescript?

TOPICS
Scripting
1.8K
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

Mentor , Jan 15, 2016 Jan 15, 2016

Hi,

with selected frame:

app.menuActions.itemByID(119681).invoke();

or create your own placeholder.txt - place it inside App Folder(or anywhere else) and use place(file) method to manage it.

Jarek

Translate
Mentor ,
Jan 15, 2016 Jan 15, 2016

Hi,

with selected frame:

app.menuActions.itemByID(119681).invoke();

or create your own placeholder.txt - place it inside App Folder(or anywhere else) and use place(file) method to manage it.

Jarek

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 ,
Jan 15, 2016 Jan 15, 2016

‌No need for an invoke, it's trivially scriptable: Adobe InDesign CS5.5 (7.5) Object Model JS: TextFrameContents

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
Mentor ,
Jan 15, 2016 Jan 15, 2016

Hi,

Right, thanks for that...

Jarek

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
Engaged ,
Jan 18, 2016 Jan 18, 2016

Jongware, looking at your link I'm overwhelmed. I'm pretty new at scripting and I'm not sure how to put together a script using your site as reference.

Do you  know of a site or webpage where I can get a better understanding of how to build a script using your guide?

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
Explorer ,
Jan 18, 2016 Jan 18, 2016

How do I do a place(file) method?

I succeeded in place through a dialog box

(var tfiYS = File.openDialog("Choose a file...");

if((tfiYS != "")&&(tfiYS != null)){

    tfYS.insertionPoints.item(-1).place(tfiYS);

})

but I want to place the file automatically without having to go through the dialog/

Do you know how to do that?

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
Mentor ,
Jan 19, 2016 Jan 19, 2016

Hi,

You are able to use method for specific class ==> thats why Jongware's site is so useful as a listed and ordered possibilities.

So the way is :

class.method(properties)

(by the way - are you going to place a text or graphics?)

if your code is:

textFrame.place(mFile)

it means to place mFile into textFrame

if your code is:

mInsertionPoint.place(mFile)

it means to place mFile exactly into mInsertionPoint

Notice that mFile should be an object - not a Path but File(Path)

Jarek

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
Explorer ,
Jan 19, 2016 Jan 19, 2016

so I tried:

var tfYS = myDocument.masterSpreads.item(0).pages.item(1).textFrames.item(4).override(myDocument.pages.item(0));

var tfiImport = File("C:\Users\Mir\Documents\YS\YS_Exported_from_InDesign.docx");

tfYS.insertionPoints.item(-1).place(tfiImport);


but it's not working

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
Mentor ,
Jan 19, 2016 Jan 19, 2016

Hi,

Use empty doc with 1 textFrame and test.txt file from Desktop

Still not working?

Does method not work or...i.e... there is no 5th textFrame on your right masterPage?

Jarek

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
Explorer ,
Jan 19, 2016 Jan 19, 2016

I tried:

#target "InDesign-10.064"

var myDocument = app.documents.add();

var myPage = myDocument.pages.item(0);

var tf = myPage.textFrames.add({geometricBounds:[1,1,2,5]});

//C:\Users\Mir\Desktop\test.txt

var tfiImport = File("C:\Users\Mir\Desktop\test.txt");

tf.insertionPoints.item(-1).place(tfiImport);

doesn't work

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 ,
Jan 19, 2016 Jan 19, 2016

I'm not sure, if backslashes for directory separation are working with object File.

(I'm on OSX, so I can be wrong)

To test in a more controllable environment, at least in my opinion, open an already saved InDesign document.

Put the text file in the folder where your InDesign document is and try the following script.

For me the path separator string is working like that: "/" (on Windows it should work as well)

var doc = app.documents[0];

var newTextFrame = doc.pages[0].textFrames.add({geometricBounds : [0,0,"100mm", "100mm"]} );

var fileToPlace = File(File(doc.fullName).path+"/"+"test.txt");

newTextFrame.texts[0].insertionPoints[0].place(fileToPlace);

Since the new text frame has no contents, I used index 0 of the insertionPoints.

Index -1 will also work. It's the same insertion point in this case.

Here another example with some contents in the new text frame:

var doc = app.documents[0];

var newTextFrame = doc.pages[0].textFrames.add({geometricBounds : [0,0,"100mm", "100mm"], contents : "Hello World!\r"} );

var fileToPlace = File(File(doc.fullName).path+"/"+"test.txt");

newTextFrame.texts[0].insertionPoints[-1].place(fileToPlace);

Uwe

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
Explorer ,
Jan 21, 2016 Jan 21, 2016
LATEST

Thank You Laubender.

My problem as you said was that I was using backslashes instead of forward-slashes. I copied the path from ESTK, and that is why I had the backslashes in the first place. Why does ESTK do that in the first place?

All the Best.

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
Engaged ,
Jan 18, 2016 Jan 18, 2016

Thank you for your help. Although it looks like its scriptable from what Jongware shows, your example worked and introduced me to a new area of scripting possibilities.

Thanks!

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 ,
Jan 20, 2016 Jan 20, 2016

-- In Applescript:

tell application "Adobe InDesign CS6"

  activate

  tell document 1

  tell page 1

  select text frame 1

  end tell

  end tell

  invoke menu action "Fill with Placeholder Text"

end tell


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