After Effects JSX字幕导出脚本 - 西里尔语问题

时间:2018-01-11 16:11:31

标签: javascript jsx after-effects

我有一个包含多种语言字幕的After Effects文件。我正在使用附加的脚本将每种语言的字幕导出为纯文本文件。这适用于拉丁语言 - 但不适用于非拉丁语言(西里尔语,俄语,斯拉夫语等),我只是得到一个时间戳和空白返回..我已经尝试更改我的Mac语言和键盘设置 - 但没有运气 - 任何人都可以提供任何指针或任何可以指向正确方向的东西吗?



/*
 Subtitle Exporter v01   
 Script by Philipp Grolle
 www.display-artists.de
 
 
 Instructions:
 Select all the Text Layers you want to export, run the script, and save the file as .srt
 
 Attention: The Script has not been debugged or testet. Try it on your own risk!


*/

// get all the selected Layers 
var theComp = app.project.activeItem;
var alleLayer = theComp.selectedLayers;

// count how many layers are selected
var anzahlLayer = alleLayer.length;


// Enable the line below if you want to change the order of your text (ascending / descending)
/* alleLayer.reverse(); */


   // prompt to save file
   var theFile = File.saveDialog("Save the text file.", "untitled.txt", "TEXT txt");
   
   // if user didn't cancel...
   if (theFile != null) {
      
      // open file for "w"riting,
      theFile.open("w","TEXT","????");
      
         // Do it for all the selected Layers
         for (x = 0; x < anzahlLayer; x++)
         
         {
                    
             // get In- and Outpoint of the current Layer and convert to timecode (00:00:00:00)
            var timecodeIn = timeToCurrentFormat(alleLayer[x].inPoint, 25);
            var timecodeOut = timeToCurrentFormat(alleLayer[x].outPoint, 25);
            
            
           // split the value of the inPoint; converting last 2 characters  (frames) to milliseconds, and finally join it again with comma instead of colon
            var str_in= timecodeIn;
            var timeCodeAnfang_in=str_in.slice(0,8); 
            var timeCodeEnde_in=str_in.slice(9,11); 
            var millisek_in = timeCodeEnde_in*40; // 1000 milliseconds divided by 25 fps = 40
            var zusammen_in = timeCodeAnfang_in +"," + millisek_in;
            
            
            //split the value of the outPoint; converting last 2 characters  (frames) to milliseconds, and finally join it again with comma instead of colon
            var str_out= timecodeOut;
            var timeCodeAnfang_out=str_out.slice(0,8); 
            var timeCodeEnde_out=str_out.slice(9,11); 
            var millisek_out = timeCodeEnde_out*40;
            var zusammen_out = timeCodeAnfang_out +"," + millisek_out;
            
            //counter for the number above the timecode (in the results)
            var zaehler = x+1;
            
            //writing the results to file
            theFile.write(zaehler);
            theFile.write("\r\n");
            theFile.write(zusammen_in);
            theFile.write(" --> "); 
            theFile.write(zusammen_out);
            theFile.write("\r\n");
            theFile.write(alleLayer[x].property("Source Text").value);           
            theFile.write("\r\n\n");
         }

   
      // close the text file
      theFile.close();
      
      // open text file in default app
      theFile.execute();
   }
&#13;
&#13;
&#13;

0 个答案:

没有答案