4 Replies Latest reply on Mar 30, 2017 7:41 AM by Silly-V

    Is there a way to script options for embed in extendscript?

    iamwickedtall1 Level 1

      I wrote a javascript to loop through images in a document, embed links and rasterize at a specific resolution. I am treating placedItems and rasterItems the same, and just using app.activeDocument.pageItems[0].rasterize(); which allows for options to be fed to it. RasterizeOptions has a property called "includeLayers" which does not function at all how it sounds like it functions, and always flattens linked files even if they have layers, which I don't think this method supports anyway. Even when true, if an image has opacity or a blending mode, the appearance rasterizes to it, which the manual mentions that this property should maintain these.

       

      What I'm wondering is if there are properties and options I can feed to embed(). Currently, it just goes by the last used settings from the embed dialog, which in some cases I will want to flatten, but others, I will want to convert to layers. Is there an ability to do this through javaacript? I'm beginning to realize I need to learn how to use the SDK so that I can have a full range of functionality.

        • 1. Re: Is there a way to script options for embed in extendscript?
          Silly-V Adobe Community Professional

          Try to search the preferences file to see if there's some information about this in there. Sometimes options which do not appear in any Illustrator scripting command are actually present in the preferences.

          You can try to get this information from the Preference file which is located here on windows:

          C:\Users\<UserName>\AppData\Roaming\Adobe\Adobe Illustrator 21 Settings\en_US\x64\Adobe Illustrator Prefs

          Open from Recent Documents List with a Script

          • 2. Re: Is there a way to script options for embed in extendscript?
            iamwickedtall1 Level 1

            Unfortunately, that file doesn't seem to contain embed settings. Also a bit problematic, because it doesn't save until you close Illustrator, if it crashes, it doesn't record. If it had, I guess I could overwrite those settings, but there still doesn't seem to be anything to feed them back into. If I could overwrite them, I guess that it would just read those, but it's not retained there. Looks like they're storing some other features in other pref files, but I'm not finding embed settings on mac. Any more thoughts are always appreciated!

            • 3. Re: Is there a way to script options for embed in extendscript?
              Silly-V Adobe Community Professional

              The preferences file is just to get a look around what they have in there. To read and set the preferences while running the program, you would be using the app.preferences object (which has only a handful of read/write methods).

              However, yea I can't find an area speaking of strictly 'embedding'. There are some zones such as PhotoshopFileFormat and TIFFFileFormat which seem to contain not only the export option information but also import option information. I started out looking at the TIFF embed dialog to try and find anything similar and am only led back to the PhotoshopFileFormat zone:

               

              /PhotoshopFileFormat {

                /PreserveSpotColors 0

                /Maximize\ Ediability 1

                /CompoundShapes 1

                /LiveText 1

                /NestedLayers 1

                /WhichProfile 0

                /WriteLayers 1

                /ExportFormat 1

                /ColorModel 1

                /AntiAlias 2

                /CustomDpi 150.0

                /DPI 150.0

                /AI\ Script 0

                /SpotOptionApplyToAll 0

                /SelectedLayerCompName [ 0

               

                ]

                /SelectedLayerCompID -1

                /ShowPreview 0

                /PixelAspectRatio 0

                /HiddenLayers 0

                /ImageMaps 0

                /Slices 0

                /PSD\ Import\ Option 2

              }

               

              Compare to TIFF format:

              /TIFFFileFormat {
              /Resolution 150.0
              /ColorModel 2
              /DPI 600.0
              /AntiAlias 3
              /LZWCompression 0
              /ByteOrder 2
              /PreserveSpotColors 0
              }

               

              It looks as if the Tiff embed options get a boost off the PSD preferences?

              To test this, you'll need to determine the syntax with which to set  one of the preferences and observe if this change is reflected in your next UI embed dialog. Then you would need to see if this really holds true for when you set the preference via script and in the very next line call an .embed() method on your placed item.

              • 4. Re: Is there a way to script options for embed in extendscript?
                Silly-V Adobe Community Professional

                Notice an interesting discrepancy in their misspelled "Preserve Ediability". This is how the file really reads, but the spelling in the dialog is correct.