🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.scripting.indesign
2 messages
2 total messages Started by Kermy Tue, 03 Feb 2009 21:07
[CS3 AS] Replace color
#1688
Author: Kermy
Date: Tue, 03 Feb 2009 21:07
10 lines
847 bytes
Hi - new to applescript.

I want to replace "White": with the Paper color
I'm missing something - why isn't this working for me?:

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

Also, it might be "WHITE", "White" or "white" is there as way to do that in one step?
Re: [CS3 AS] Replace color
#1690
Author: 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>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads