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

CS5 Story::exportFile

New Here ,
Aug 03, 2010 Aug 03, 2010

Hello guys,

I have a big problem with the exportFile-method of the Story scripting object. In CS4 the following code results in a file named "icml.icml"

myStory = app.documents[0].stories.itemByID(123);
cacheFile = new File('/Users/username/Desktop/icml.icml');

myStory.exportFile(ExportFormat.INCOPY_MARKUP, cacheFile);

but in CS5 the file name differs in a strange way:

icml-sometext.icml

"sometext" seems to be the first n letters of the story content. Is there any way to disable this feature to have the same file name as in CS4?

Thanks in advance!

TOPICS
Scripting
836
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 ,
Aug 03, 2010 Aug 03, 2010

@Peter: if that's the case, and I have no doubt, but can't test it right now, is there a rule how many additional characters will go into "-sometext"? You could then strip them from the file name by manipulating the string.

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
New Here ,
Aug 03, 2010 Aug 03, 2010

That would be a possible workaround, but my question is, why this behavior has changed in that way since CS4? In my opinion this is a bug, because its not possible any more to get the exact path to an exported file...

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 ,
Aug 03, 2010 Aug 03, 2010

Hi Peter,

I have tried your code and its seem indesign add extra texts in exported file when same name file already exists on target place.

Try below one becuase its working for me

myStory = app.documents[0].stories.itemByID(197);
cacheFile = new File('/Users/shonky/Desktop/icml.icml');
if(!cacheFile.exists)
{
myStory.exportFile(ExportFormat.INCOPY_MARKUP, cacheFile);
}

else

{

alert("File already exists")

}

Shonky

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
New Here ,
Aug 03, 2010 Aug 03, 2010
LATEST

This is a good point, thanks. I missed the fact that the file i am exporting already exists because of a previous operation in my code. But for me this behavior is also strange, as i would expect the file to be overwritten like in CS4. But I can make a workaround so the file will not exist before exporting it.

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