Skip to main content
Known Participant
July 14, 2020
Question

importing data from the text file into the layer--illustrator

  • July 14, 2020
  • 1 reply
  • 509 views

Hi everyone,

I need a script to add the data from the seperate text file to the respective layer of illustrator file.

This topic has been closed for replies.

1 reply

femkeblanco
Legend
July 14, 2020

Your question is very nonspecific, but here are the basic steps:  (1) read a file and (2) add the text to a layer (in this case, as area type).  (Replace "..." with the address to your file name.)

 

var address1 = "/C/Users/.../yourFileName.txt";
var file1 = new File(address1);
file1.open("e");
var contents1 = file1.read();
file1.close();
var doc1 = app.activeDocument; var layer1 = doc1.layers.add(); var path1 = layer1.pathItems.rectangle(0, 0, doc1.width, doc1.height); var text1 = activeDocument.textFrames.areaText(path1); text1.contents = contents1;

 

Rocky@Author
Known Participant
July 15, 2020

Thanks femkeblanco,

Sorry for not mentioned in detail.

I need a code to update the data into the layer(eg., test) of the active document of illustrator. But the data from the text file was called by apple script and append through javascript. I dont need call directly from javascript.