🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #1690

Re: [CS3 AS] Replace color

#1690
From: Shane_Stanley
Date: Tue, 03 Feb 2009 22:13
34 lines
2291 bytes
On 4/2/09 8:07 AM, "Kermy" <member@adobeforums.com> wrote:

> tell application "Adobe InDesign CS3"
>     delete swatch "White" replacing with swatch "Paper"
> end tell 

This is targetted at the application -- if you want to do it in a document,
you need to insert "tell document 1".
> 
> Also, it might be "WHITE", "White" or "white" is there as way to do that in
> one step? 

You'll need to do something like get the name of every swatch, then loop
through doing a comparison inside an "ignoring case" construct. Something
like this:

tell application "Adobe InDesign CS3"
    tell document 1
        set colorNames to name of swatches whose name is not ""
        ignoring case
            repeat with i from 1 to count of colorNames
                if item i of colorNames = "White" then
                    delete swatch (item i of colorNames) replacing with
swatch "Paper"
                end if
            end repeat
        end ignoring
    end tell
end tell


-- 
Shane Stanley <sstanley@myriad-com.com.au>
AppleScript Pro Florida, April 2009 <http://scriptingmatters.com/aspro>
Technical Details
Message-ID: <C5AF0CCE.4E0C7%sstanley@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
References: <59b7c599.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,ec63a7ff5d3e52da
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Shane_Stanley@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: [CS3 AS] Replace color
Message-ID: <C5AF0CCE.4E0C7%sstanley@myriad-com.com.au>
Date: Tue, 3 Feb 2009 14:13:50 -0800
References: <59b7c599.-1@webcrossing.la2eafNXanI>
Lines: 40
Received: from outbound.icp-qv1-irony-out3.iinet.net.au [203.59.1.148] by adobeforums.com; Tue, 3 Feb 2009 14:14:26 -0800
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AsIBALNQiEnSVD1L/2dsb2JhbAAIz0WEFAY
X-IronPort-AV: E=Sophos;i="4.37,374,1231081200"; 
   d="scan'208";a="385161565"
Received: from unknown (HELO [10.1.1.4]) ([210.84.61.75])
  by outbound.icp-qv1-irony-out3.iinet.net.au with ESMTP; 04 Feb 2009 07:13:53 +0900
User-Agent: Microsoft-Entourage/12.15.0.081119
Thread-Topic: [CS3 AS] Replace color
Thread-Index: AcmGTLDhUDrmT2QW0EiLxOGghmHI1w==
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit