Copy link to clipboard
Copied
Does anyone know if Fill with placeholder text is accessible through javascript or applescript?
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
No need for an invoke, it's trivially scriptable: Adobe InDesign CS5.5 (7.5) Object Model JS: TextFrameContents
Copy link to clipboard
Copied
Hi,
Right, thanks for that...
Jarek
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
-- 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
Find more inspiration, events, and resources on the new Adobe Community
Explore Now