4 Replies Latest reply on Dec 9, 2015 8:30 PM by fredsky2014

    scripting with cc libraries ?

    mikeymiz

      I've written some scripts to place objects in illustrator or photoshop files, from a source folder on my computer.

      Can I upload the files in the souce folder to a CC Library, and read the data from the CC library?

       

      Has this ever been done ?

      Does anyone have any examples ?

       

      Thanks ,

       

      Mike

        • 1. Re: scripting with cc libraries ?
          Silly-V Adobe Community Professional

          Hmm I did find this in the OMV:

          Application.openCloudLibraryAssetForEditing (assetURL: File , thumbnailURL: File , options:any): Document

          Adobe Illustrator 19 Type Library

          For Internal Use.

          assetURL: Data Type: File

          For Internal use.

          thumbnailURL: Data Type: File

          For Internal use.

          options (optional): Data Type: any

          For internal use.

           

          But, I am not sure how to use CC Libraries, and never messed with my account on CC for these purposes.

          • 3. Re: scripting with cc libraries ?
            Qwertyfly... Level 4

            good to note that library files are all stored on the computer.

            so using the linked asset from the library you can access the file path.

             

            you will get a path something like:

            "~/AppData/Roaming/Adobe/Creative%20Cloud%20Libraries/LIBS/70DE407249FFD926992016B8_AdobeI D/creative_cloud/dcx/91e58ef0-532a-11e4-972c-df5d87bc480c/components/a6d3012d-85d5-42cb-be 8c-0caf3a93b267.ai"

             

            if you edit the asset the name will change.

            saving a file in this directory will not add it to the library.

            I am not sure if the file name is the same on all machines.

             

            I know no way to get an array of library items, which is a pain.

             

            My thoughts would be to add the source folder of files to the "Creative Cloud Files"

            that way you can use the script you already have written, and all the files can be named as you want.

            and we don't need to worry about the files name changing whenever the master is edited.

            we also can share this with many more machines then libraries.

             

            let me know if I can help you any more with this. good luck.

            • 4. Re: scripting with cc libraries ?
              fredsky2014

              hello mike!

              since Qwertfly helped me, (see the CarlosSanto link), i guess i'm alone to really use a script to export libraries object as SVG.

              but to create / import a AI object as a library i can not found any function/method.

               

              here is a extract of my code:

              - a library object is a placed and a linked item.

              - i guess that with the special file path of a library object, you can identify it (i call it "myAsset")

               

              try {
                          //artItem exists?
                          if (sourceDoc.pageItems[index].file.exists) {
                              artItem = sourceDoc.pageItems[index];
                                                             
                              //retrieve the matrix of transformation applyied to this object
                              get_matrix = artItem.matrix;       
                              get_matrix = concatenateScaleMatrix(get_matrix, 100, -100);
                              //get_matrix = concatenateTranslationMatrix(get_matrix);
                             
                              invMatrix = invertMatrix(get_matrix);
                              invMatrix.mValueTX = 0;
                              invMatrix.mValueTY = 0;               
                              get_matrix.mValueTX = 0;
                              get_matrix.mValueTY = 0;           
                          }
                         
                          //alert("artItem.file.fsName "+ artItem.file.fsName);
              
                        // save EACH linked asset as svg
                          if ( artItem.file.fsName != "" && !artItem.hidden )
                          {
                              if (artItem.locked) { artItem.locked=false; }
                             
                              // get the file reference path
                              myAsset = File(artItem.file.fsName); 
                              //alert("myAsset "+ myAsset);
                             
                              // CC 2015 only, open item as edit in new doc
                              app.openCloudLibraryAssetForEditing(myAsset,myAsset);               
                              activeDoc = app.activeDocument;    // returns the active document object
                              activeDoc.coordinateSystem = CoordinateSystem.ARTBOARDCOORDINATESYSTEM;
                              app.coordinateSystem = CoordinateSystem.ARTBOARDCOORDINATESYSTEM;
                             
                              //*****************
                              //*** this edited item DOES NOT care the properties of the parent document
                              //**** so we must save all infos (position, size, rotation,... )
                              app.executeMenuCommand ('selectall');
                              selection[0].transform(get_matrix);
                             
                              //recalculate artboard size after rotation
                              activeDoc.artboards[0].artboardRect = activeDoc.visibleBounds;           
                              //alert("re transfrome...");
                              activeDoc.selection = null;
                         
                              //save info from this item
                              var itemleft;
                              var itemtop;
                              var itemwidth;
                              var itemheight;
                              itemwidth = artItem.width;
                              itemheight = artItem.height;
                                itemleft=artItem.left;
                              itemtop=artItem.top *-1; //y-axis is inverted!!