3 Replies Latest reply on Apr 25, 2016 9:34 AM by Laubender

    Embed file preview by script?

    DBLjan Level 2

      Oh my!

      Some of my coworkers have bad workspace settings and "messed up" documents for years, not embedding hires page previews

      So, i wanted to batch process this into the files, i came up with this:

       

      set myfolder to choose folder
      
      tell application "Finder" to set myfiles to files of the entire contents of myfolder as alias list
      
      repeat with thisFile in myfiles
          tell application "Adobe InDesign CS5.5"
              open thisFile without showing window
              set properties of general preferences to {preview size:extra large, include preview:true}
              close document 1 saving yes
          end tell
      end repeat
      
      display notification "done"
      

       

      This runs okay, but doesnt seem to "update" the file, because they arent actually saved again i guess. So, what can I do to change my file to force a save with previews?

      My idea was to make a change to the metadata…

       

      tell metadata preference of document 1
          set description to "thumbnailed"
      end tell
      

       

      …but all i get is this error, dont know why metadata cant be set;:

       

      error "„Adobe InDesign CS5.5“ hat einen Fehler erhalten: „description of metadata preference of document 1“ kann nicht als „\"thumbnailed\"“ gesetzt werden." number -10006 from description of metadata preference of document 1

       

      Please guys, help me out, i guess im this close…

        • 1. Re: Embed file preview by script?
          Laubender Adobe Community Professional & MVP

          Hi Jan,

          just add a rectangle to the doument and remove it.

          Then the document is in a changed state.

          The preview should be updated after saving.

           

          And maybe the "without showing window" should not be used.

          Why not showing the window?
          Performance reasons?

           

          Uwe

          • 2. Re: Embed file preview by script?
            DBLjan Level 2

            Moin Uwe,

             

            thank you for your help again and again:

            just adding and deleting an item…brilliant…didnt came up that.
            Now that the script is working, do you have a clue why I cant change the metadata in the first place?

             

            function setMetadata() {app.activeDocument.metadataPreferences.author = "Uwe the Great";}

            I have an startup-script which adds some metadata, which works, but in JS. I guess its a small thingy why i cant change via AS…

            • 3. Re: Embed file preview by script?
              Laubender Adobe Community Professional & MVP

              Sorry Jan,

              AppleScript is not my domain.

               

              Couldn't you do the whole script with ExtendScript?
              And only necessary parts in AppleScript using doScript()?

               

              Or open up a new thread with the question regarding the metadata…

               

              Uwe