• 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
Script to Open Camera RAW File Doesn't Open File, Gives No Error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Script to Open Camera RAW File Doesn't Open File, Gives No Error


  • Subject: Script to Open Camera RAW File Doesn't Open File, Gives No Error
  • From: Rick Gordon <email@hidden>
  • Date: Mon, 23 May 2016 00:49:06 -0700

I've tried to build this script to run on a selected JPEG image placed in InDesign, so that it will open an associated Camera Raw file in the same folder (with same name, different extension) into Photoshop.

It runs without error, reaching the end of the script, but the file does not open up into the ACR module in Photoshop. It activates, but no window opens, and no error is triggered.

I don;t understand why.

I originally tried just opening the alias (not POSIX path), but that produced a -43 error. Converting that to a POSIX path generates no error, and Photoshop is activated after the line
open vCameraRawFilePOSIXPath as Camera RAW
BTW, I tried it also without the "as Camera RAW", but the same thing happens: no error but no opened file.

-----------------
set vExtensionList to {".raf", ".orf", ".cr2", ".nef"}
set vEmptyList to {}

tell application "Adobe InDesign CS6"
    tell item 1 of selection of document 1
        if class of it is image then
            set vImage to it
        else
            try
                set vImage to item 1 of all graphics of it
            on error vErrorMessage
                display alert "Not an image"
                return
            end try
        end if
        tell item link of vImage
            if link type is not "JPEG" then
                display alert "Not a JPEG"
                return
            end if
            set vImageAlias to file path as alias
            set vImageFullName to name
            tell application "Finder"
                tell container of file vImageAlias
                    set my text item delimiters to {".jpg", "jpeg"}
                    set vImageBaseName to text item 1 of vImageFullName
                    repeat with vItem in vExtensionList
                        try
                            set end of vEmptyList to (some file whose name is vImageBaseName & vItem)
                        end try
                        if length of vEmptyList > 0 then
                            set vCameraRawFile to (item 1 of vEmptyList) as alias
                            set vCameraRawFilePOSIXPath to POSIX path of vCameraRawFile
                            exit repeat
                        end if
                    end repeat
                end tell
            end tell
            tell application "Adobe Photoshop CC 2015"
                open vCameraRawFilePOSIXPath as Camera RAW
                activate
            end tell
        end tell
    end tell
end tell
-----------------
___________________________________________
RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________
WWW: http://www.shelterpub.com
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Script to Open Camera RAW File Doesn't Open File, Gives No Error
      • From: Rick Gordon <email@hidden>
  • Prev by Date: Re: Reload Library?
  • Next by Date: Re: Script to Open Camera RAW File Doesn't Open File, Gives No Error
  • Previous by thread: Re: Where to Place [use framework "Foundation"] for ASObjC Handlers?
  • Next by thread: Re: Script to Open Camera RAW File Doesn't Open File, Gives No Error
  • Index(es):
    • Date
    • Thread