Skip to main content
Inspiring
February 4, 2010
Answered

Document Raster Effects Settings... again...

  • February 4, 2010
  • 1 reply
  • 5625 views

Hi All,

I know this has been asked a couple of times before, but I don't think anyone ever confirmed the correct way of querying/setting these values.  I'm using the CS3 SDK on Mac OS X 10.6.2

So, as the subject states, I'm after the values in the "Document Raster Effects Settings..." dialog, located in the "Effects" menu.  Specifically, the "Resolution".  I believe it was suggested in the previous threads about this to look at the "outputResolution" field of the AIDocumentSetup struct.  The CS3 SDK states that this field is "Not Used" and the field itself always seems to be set to 800.0 for me.

I noticed that these values were local to the document itself and that modifying them causes the documents dirty flag to be set. So I thought maybe they're stored in the document's dictionary.  So I dumped out the key strings from the document's dictionary and found "AI9 Output Rasterization Resolution" which (after having to guess the data type) always seems to be 300.

I don't know where else to look.  These values have to be stored somewhere as they are stored with the document.  I can view them easily as part of the document object via an Applescript dictionary explorer, but I refuse to believe that Applescript has access to a value that I don't via a plugin.

If anyone can help me shed any light on this I'd really appreciate it!

-W

This topic has been closed for replies.
Correct answer A. Patterson

Setting the Document Raster Effects is actionable, so you could always use that as a means. I recorded an action that set the settings to the following:

Model: CMYK

Resolution: 300 dpi

Background: Transparent

Anti-alias: No

Create Clipping Mask: No

Padding: 36 pt

The action looks like this:

/version 2
/name [ 5
    5365742031
]
/isOpen 1
/actionCount 1
/action-1 {
    /name [ 8
        416374696f6e2033
    ]
    /keyIndex 0
    /colorIndex 0
    /isOpen 1
    /eventCount 1
    /event-1 {
        /internalName (ai_plugin_rasterEffectSettings)
        /localizedName [ 32
            446f63756d656e742052617374657220456666656374732053657474696e6773
        ]
        /isOpen 1
        /isOn 1
        /hasDialog 1
        /showDialog 0
        /parameterCount 6
        /parameter-1 {
            /key 1668246642
            /showInPalette -1
            /type (enumerated)
            /name [ 4
                434d594b
            ]
            /value 5
        }
        /parameter-2 {
            /key 1685088558
            /showInPalette -1
            /type (integer)
            /value 300
        }
        /parameter-3 {
            /key 1651205988
            /showInPalette -1
            /type (enumerated)
            /name [ 11
                5472616e73706172656e74
            ]
            /value 1
        }
        /parameter-4 {
            /key 1634494835
            /showInPalette -1
            /type (boolean)
            /value 0
        }
        /parameter-5 {
            /key 1835103083
            /showInPalette -1
            /type (boolean)
            /value 0
        }
        /parameter-6 {
            /key 1885430884
            /showInPalette -1
            /type (unit real)
            /value 36.0
            /unit 592476268
        }
    }
}

Its pretty obvious which parameters are which, so one should be able to use AIActionSuite::PlayAction at worst to change the document raster settings.


Nevermind, I found the dictionary entries. The document's dictionary has an entry called 'AI Auto Rasterize'. That is itself a dictionary, which contains the following entries:

'padd', real entry (Padding)

'mask' boolean entry (Create Mask)

'spot' boolean entry (Preserve Spot Colours)

'alis' boolean entry (Anti-Alias)

'dpi.' integer entry (DPI, yes, that is a period at the end)

'colr' integer entry (combination of Colour Model & background colour)

That last one will take a little bit of investigation. I think there must be an enum for it somewhere in the headers, but when I changed CMYK (with transparent background) to Greyscale (with transparent background) I believe it changed from 5 to 4. When I tried CMYK (with white background) it went to 1. So those two settings are obvious tied up together, but at worst we can just map them out once and be done with it.

1 reply

A. Patterson
Inspiring
February 4, 2010

Man, a lot of people seem to want to do this and apparently we have never found a solution I wish someone from Adobe would chime in here, I'm afraid I'm tapped out for ideas. Unless its actionable, in which case you could probably use AIActionSuite::PlayAction to do an end run on setting it. That said, feels kind of dumb that its so hard to modify document setup when there's an obvious struct.

Inspiring
February 5, 2010

It is getting kinda frustrating.  I've now resorted to listening for a various notifications for clues as to what's going on when that "Ok" button is clicked in the dialog.  So far I'm catching a preferences-changed notification but I haven't yet determined what (if anything) is being sent with it, guess I'll keep looking.

My only goal here is reading the current "Resolution" value, I have no need to modify it.  I'm hoping this much is possible and of course, if I get anywhere, I'll post the details here of course

-W

A. Patterson
Inspiring
February 5, 2010

Mr Patterson, you are the man

I had originally started to write a dictionary 'walker' to traverse each entry, determine its type and display its value, but I decided to put it down and carry on with some other work and hope for some fresh inspiration.   Guess I should've continued!

I don't have access to the code at the moment but I'll give it a go as soon as I am.  I saw that key too but it just never clicked that it could contain another dictionary with everything I needed.

On an interesting side note, while I was looking at some of the other notifications, I see there is a "

_AIDictionaryKeyChangedNotifyData" structure in AIDictionary.h.  I also remember seeing somewhere, a comment stating that this notification is never sent.

Thanks again, I appreciate the time and effort you've put in to investigate this.  If there were an MVP equivalent from Adobe, you'd get one

-W

Actually, it didn't take a whole lot of effort once you mentioned the dictionaries. I wrote a dictionary walker myself late last year for debug testing; depending on what key you're holding down it will dump the dictionaries for the art you hit, or the current layer or the dictionary. So it was fairly easy to test I wish it was stand alone, I'd post it somewhere, but unfortunately its pretty tightly integerated into our product so I can't


Dictionary key notifier? Interesting. I just did a search and turned it up (top of AIDictionary.h), but unfortunately it has this in the comment:

/** The data for the dictionary key-changed notifier. (Not currently sent). */

Heh, figures

At any rate, this comes up so often I'm just glad we can finally put it to rest. I suspect this thread will get linked to an awful lot!