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

How do I load an ICML File?

Explorer ,
Jan 02, 2017 Jan 02, 2017

Copy link to clipboard

Copied

Hello,

Chapter 12 of the Javascript Scripting Guide talks about loading XML files into elements of an InDesign document, and about styling them using tags-to-style mappings. Given an InCopy ICML file, however, how do I place its content in a document? Using that same XML facility, or is there another and better way of loading and placing ICML files into InDesign documents?

Thank you,

Jens

TOPICS
Scripting

Views

3.3K

Translate

Translate

Report

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

Community Expert , Jan 03, 2017 Jan 03, 2017

You simply place the ICML-File into a Textframe:

app.activeDocument.textFrames[0].place(icmlFile); 
// optional unlink
dok.links.itemByName(icmlFile.name).unlink();

Votes

Translate

Translate
Community Expert ,
Jan 03, 2017 Jan 03, 2017

Copy link to clipboard

Copied

You simply place the ICML-File into a Textframe:

app.activeDocument.textFrames[0].place(icmlFile); 
// optional unlink
dok.links.itemByName(icmlFile.name).unlink();

Votes

Translate

Translate

Report

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 03, 2017 Jan 03, 2017

Copy link to clipboard

Copied

grefel​ Thank you for mentioning the TextFrame.place() method, that’s what I was looking for. It takes a File argument though, and Javascript’s File class doesn’t seem to implement a wrapper for a string or stream (which is how the ICML arrives in my case). I might be able to use a temporary file in local storage though, I shall poke around...

I also noticed that line breaks and spaces in the ICML file are replicated exactly, including page breaks that I haven’t quite figured out where they come from.

Thank you!

Votes

Translate

Translate

Report

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 11, 2017 Jan 11, 2017

Copy link to clipboard

Copied

There is no wrapper for String or Stream. I would write a temporary file to disk.

Votes

Translate

Translate

Report

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 ,
Mar 09, 2017 Mar 09, 2017

Copy link to clipboard

Copied

grefel​, is it possible that the place() function works differently on 2015.4 (11.4.0.90) than it does on my 12.0.0.81? I ask because a customer does not see any content of the placed ICML file, and since I don’t have that version of InDesign I can’t really test...

Votes

Translate

Translate

Report

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 ,
Mar 10, 2017 Mar 10, 2017

Copy link to clipboard

Copied

LATEST

I'm quite sure that place() works the same way in 2015.4 (11.4.0.90) and 2017 and all the other version since I started scripting with CS3.

To check: Do you use the mentioned code block with unlink:

app.activeDocument.textFrames[0].place(icmlFile);

dok.links.itemByName(icmlFile.name).unlink();

Votes

Translate

Translate

Report

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 03, 2017 Jan 03, 2017

Copy link to clipboard

Copied

Hi Jens,

you could check what placeable file extensions can be used:

// Writes the result to the JavaScript Console of the ExtendScript Toolkit (ESTK)

app.placeableFileExtensions.sort().join("\r");

// Result for e.g. InDesign CS6 v8.1.0 on Mac OSX:

AI

AIF

AIFF

AU

AVI

BMP

CT

DCS

EMF

EPS

F4V

FLV

GIF

JPE

JPEG

JPG

M15

M1A

M1S

M1V

M64

M75

MOV

MP2

MP4

MPA

MPEG

MPG

MPM

MPV

PCC

PCT

PCX

PDD

PIC

PMG

PNG

PSD

RLE

SCT

SWF

TIF

TIFF

TP1

TRP

TXT

WAV

WAVE

WMF

doc

doc

docx

icml

idms

incd

incx

indd

inds

indt

joboptions

mp3

oam

pdf

pdp

rtf

txt

utxt

xls

xlsx

However, I did not test, if all of these will work for the Mac version.

And InDesign will be agnostic on cases:

E.g. myDocument.jpg and myDocument.JPG will work alike.

Regards,
Uwe

Votes

Translate

Translate

Report

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