K4 assign articles
Hi All,
I want to assign articles to multiple files, I am able to do it, but not able to change user color to yellow. I am not able to find Here properties for color information.
Here is my code.
- myFolder = Folder.selectDialog ("Select folder with indd...");
- if(myFolder != null){
- batch_process (myFolder);
- }
- function batch_process (theFolder) {
- var myFileList = theFolder.getFiles();
- for(var i=0; i<myFileList.length; i++){
- var myFile = myFileList;
- if(myFile instanceof File && myFile.name.match(/\.indd$/i)){
- try {
- var doc = app.open (myFile, true);
- }catch (e) {
- alert("Please open in upper version...");
- exit();
- }
- //insert function here
- add_article (doc);
- try {
- doc.close(SaveOptions.YES);
- }catch (e) {
- alert("InDesign file is converted...");
- exit();
- }
- }else if(myFile instanceof Folder){
- batch_process (myFile);
- }
- }
- }
- function add_article (myDocument) {
- var myArticleName = myDocument.name.slice(0, -5);
- if(myDocument.k4Articles.length == 0){
- var myArticle = myDocument.k4Articles.add({k4Name: myArticleName, articleColor: UIColors.YELLOW});
- //~ myArticle.label = UIColors.YELLOW;
- }else {
- alert("Already, articles created in this document...");
- exit(0);
- }
- for(i=0; i<myDocument.stories.length; i++){
- myArticle.k4AttachObjectInDocument(myDocument.stories);
- }
- }
Could anyone help me?
Sumit
