• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
AppleScripting ColorSync
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AppleScripting ColorSync


  • Subject: AppleScripting ColorSync
  • From: "Fleisher, Ken" <email@hidden>
  • Date: Wed, 05 Dec 2007 08:41:42 -0500
  • Thread-topic: AppleScripting ColorSync

Hello. This is a cross-post with the AppleScript-Users group. I did not
receive any responses there so I thought I¹d try here. Thanks in advance for
any help!

I am trying to script some color conversions but cannot seem to make it
work. I¹m not sure what I¹m doing wrong and I can¹t find any good
references. Here is a simple example:

-- watch line breaks; there is only one line inside the tell block
tell application "ColorSyncScripting"
    match alias "Mac HD:Users:k-fleisher:Desktop:C11394_20 copy.tif" from
source "Adobe RGB (1998)" to destination "ProPhoto RGB" matching with
absolute colorimetric intent using quality best
end tell


For some reason, this script has no effect on the image file. I used the
model from the example scripts supplied by Apple and I can't see why this
shouldn't work. Further, in a more complex script, I am getting an error
-176, but I cannot seem to find a reference to what this error is. If anyone
can point me to error listings for ColorSyncScripting.app I'd appreciate
that.

Can anyone see why the following code causes an error -176?


on run
    set somefile to choose file with prompt "Choose an image"
    open somefile
end run

on open draggeditems
    try
        set startTime to current date
        tell application "ColorSyncScripting"
            launch
            set quit delay to 5
        end tell

        set sourcefiles to filelistFromSelection(draggeditems)
        repeat with thisFile in sourcefiles
            set thisFile to thisFile as alias

            tell application "ColorSyncScripting"
                embed thisFile with source alias "Mac
HD:Users:k-fleisher:Library:ColorSync:Profiles:AdobeRGB1998_D65_2_D57.icc"

                -- the following line causes error -176
                match thisFile to destination profile "Adobe RGB (1998)"
matching with absolute colorimetric intent

            end tell
        end repeat

        set endTime to current date
        display dialog ((endTime - startTime) as string) & " seconds to
complete."
    on error errmsg
        activate
        display dialog errmsg
    end try
end open


--returns dragged files OR files at first level of one dragged folder
on filelistFromSelection(theselection)
    set hasfolder to false
    tell application "Finder"
        repeat with thisItem in (theselection as list)
            if (class of item thisItem is folder) or (class of item thisItem
is disk) then
                set hasfolder to true
            end if
        end repeat
    end tell
    if ((count item of (theselection as list)) > 1) and hasfolder then
        display dialog "Drag multiple files or a single folder." buttons
{"OK"} default button 1
        return ""
    end if
    tell application "Finder"
        if hasfolder then
            set filelist to (every item of folder (item 1 of (theselection
as list))) as alias list
        else
            set filelist to (theselection as list)
        end if
    end tell
    return filelist
end filelistFromSelection

--
Ken Fleisher

Photographer
Imaging & Visual Services
National Gallery of Art
Washington, D.C.

Phone: (202) 712-7471
email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Colorsync-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: AppleScripting ColorSync
      • From: Rolf Gierling <email@hidden>
    • Re: AppleScripting ColorSync
      • From: Lorenzo Ridolfi <email@hidden>
    • Re: AppleScripting ColorSync
      • From: Martin Orpen <email@hidden>
  • Prev by Date: Re: Samsung XL20
  • Next by Date: Re: AppleScripting ColorSync
  • Previous by thread: Re: About monitor profiles
  • Next by thread: Re: AppleScripting ColorSync
  • Index(es):
    • Date
    • Thread