🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18304

Re: AS - Color space lost

#18304
From: Shane Stanley
Date: Sat, 05 Apr 2003 10:59
35 lines
2212 bytes
in article 1de8946f.-1@WebX.la2eafNXanI, Fernando G. Jensen wrote:

> The following script returns the color space of an image (RGB, CMYK). While
> working in Script Editor (latest version) the value returned is RGB, but when
> the script is saved as an application the value returned is <<constant e085>>.
> This also happens when trying to collect the same information in Photoshop ..
> any ideas?

It's a result of the way scripts are stored. When you type "RGB", what
actually gets stored is a code that means RGB. The conversion between the
code and the English representation is done when the script is opened in a
script editor, using the dictionary as a translator.

This means the conversion to to "RGB" is done while you run the script from
your editor, but when you run it as an app, there's no editor opening the
dictionary and doing the translation.

The usual way to get around this is to use the constants on both sides of
the comparison, and avoid coercing to strings. So you might do something
like:

tell application "InDesign 2.0.2"
 tell document 1
  set fileColorSpace to color space of image 1 of item 1 of selection
  if fileColorSpace is rgb then -- no strings
   -- do something
  else
   --do something else
  end if
 end tell
end tell

 
-- 
Shane Stanley,  sstanley@myriad-com.com.au
Technical Details
Message-ID: <BAB4F424.54CC7%sstanley@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de8946f.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,da987bc970ef8698
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-04-05 03:07:39 PST
From: Shane Stanley <sstanley@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: AS - Color space lost
Message-ID: <BAB4F424.54CC7%sstanley@myriad-com.com.au>
Date: Sat, 5 Apr 2003 02:59:17 -0800
References: <1de8946f.-1@WebX.la2eafNXanI>
Lines: 46
User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.6
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit