从书中打开文件时,InDesign会崩溃

时间:2015-02-25 12:12:57

标签: adobe-indesign extendscript

编辑较短的版本:

我正试图在InDesign中关闭一本打开的书并在之后运行一些功能。看起来下一步是在书完全关闭之前开始的

myBook.close();

alert("Book closed");

我的警报显示仍然在背景上打开的书。如果我对书中的文件进行任何操作,它会崩溃InDesign。原帖子中的更多细节。

===============================

很抱歉很长的帖子。

我正在InDesign中制作一本书。 MAC OSX 10.9.5 Indesign CS5.5 首先,我创建并填充大约30章,在开头添加TOC章节,在结尾添加另一章,创建一本书,将所有章节添加到书中,关闭并保存书籍。之后,我试图打开最后一个TOC章节来插入TOC。文件打开后Indesign崩溃。

没有文件打开语句一切正常。

代码示例:

创建本书后

// myBook is referenced through the app.open(myBookFile);  
// with myBookFile is a string - path to the file
// also tried to re-reference book after open file by using app.books[0]

myBook.updateAllNumbers(); // tried to disable, did not help

//$.sleep(5000);  //tried this, did not help

app.activeBook.close();  

// also tried myBook.close(); no change
// tried myBook.close(SaveOptions.YES); no change

//$.sleep(5000); //tried this, did not help

      //$.sleep(5000);

      // add toc to the last chapter

      alert("Before TOC Insert");

      indexAddTOC();

      alert("Build is complete");

当第一个警报出现时,我可以看到该书仍处于打开状态。同时使用EST调试器也会在第一个警报之前关闭本书(并且不会使InDesign崩溃)。

我可以看到最后一条消息,并且在此InDesign崩溃之后。重新打开后,它会打开书中的每一章。

 function indexAddTOC(){

// re-open index file

var myFolder = new Folder("~/Desktop/"  + publicationName.replace(/ /g, "_").replace(/:/g, ""));

var myFileName =  "000".substr( 1,3 - selectionNumber.toString().length) + selectionNumber  + "_Index.indd";

var myFile = File(myFolder.fsName + "/" + myFileName);

app.open(myFile); // disabling this eradicates the error

}

错误消息:

enter image description here

错误报告转储包含:

Thread 16:
0   libsystem_kernel.dylib          0x98b4e046 __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x947d4dcf _pthread_wqthread + 372
2   libsystem_pthread.dylib         0x947d8cce start_wqthread + 30

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x00000040  ebx: 0x00000040  ecx: 0x00000040  edx: 0x00000000
  edi: 0xbfffac54  esi: 0x00000040  ebp: 0xbfffab88  esp: 0xbfffab70
   ss: 0x00000023  efl: 0x00010282  eip: 0x947d6bd5   cs: 0x0000001b
   ds: 0x00000023   es: 0x00000023   fs: 0x00000000   gs: 0x0000000f
  cr2: 0x00000040

Logical CPU:     0
Error Code:      0x00000004
Trap Number:     14

感觉书中的问题没有正确结束。任何人之前都有类似的问题,并且知道如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

也许像

while(app.books.itemByName(myBookFile).isValid){}

代替你的睡眠?我现在无法测试,但这只是一个想法。

相关问题