• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Code to open PSD with 'read composite data' (shift+control+open file)

New Here ,
Feb 10, 2018 Feb 10, 2018

Copy link to clipboard

Copied

Hey!

Goal: Use a script to open a PSD with 'read composite data' to open the image/s flattened.

Use case/why: Significantly speed up the process of batch exporting big and heavy images.

When opening a document while holding down Shift+Control, Photoshop asks "Read the composite data instead?", and opens the file flattened. Which is faster than opening the whole file with all the layers. This saves time when opening very big files, which is handy when the only reason for opening the files are to export them quickly.

I have used ScriptingListener and consulted with the scripting documentation, plus some google-fu, without luck.

Is this possible to do with javascript within Photoshop?

(JS within Photoshop is of course preferred. The only other way I can think of (is a little outside of scope for this forum) is through an AppleScript outside of Photoshop to send the keystrokes to the OS, open the specified files in Photoshop and then steer Photoshop "from the outside", running actions etc. But I haven't found any example on the internet where pushing keys and opening can be combined, only as separate steps after each other.) !

TOPICS
Actions and scripting

Views

706

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Adobe Employee ,
Feb 16, 2018 Feb 16, 2018

Copy link to clipboard

Copied

I don't see the shift or control getting recorded or available for playback in some other fashion. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 02, 2021 Nov 02, 2021

Copy link to clipboard

Copied

@Tom Ruark 

 

Couldn't something be done with psd read options for maximizeCompatibility with QueryStateType?

 

I'd post some code, but the syntax is killing me at the moment...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 01, 2021 Nov 01, 2021

Copy link to clipboard

Copied

I realize this is an old thread but I need this capability. Were you ever able to solve this?
Thanks so much.
Scott

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 07, 2024 Mar 07, 2024

Copy link to clipboard

Copied

Try this AppleScript. I can't figure out how to bypass the dialog, but this can be adapted to automate composite opening:

on openCompositeInPhotoshop(filename)
	tell application "System Events"
		key down {option, shift}
		tell application "PS for SL"
			activate
			set thisFile to filename as string
			open alias thisFile
		end tell
		key up {option, shift}
	end tell
end openCompositeInPhotoshop

set filePath to POSIX file "/Volumes/FOLDER/SUBFOLDER/SUBFOLDER/YOUR FILENAME HERE.psd" as alias
openCompositeInPhotoshop(filePath)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 07, 2024 Mar 07, 2024

Copy link to clipboard

Copied

This is probably more helpful as it allows for the user to select multiple files for composite opening in Photoshop. Just hold down the "Return"/"Enter" key until finished!

on openCompositeInPhotoshop(fileList)
	tell application "System Events"
		key down {option, shift}
		repeat with thisFile in fileList
			tell application "Photoshop"
				activate
				open thisFile
			end tell
		end repeat
		key up {option, shift}
	end tell
end openCompositeInPhotoshop

-- Allow user to choose multiple files
set fileList to choose file with prompt "Select one or more files:" of type {"psd"} with multiple selections allowed

-- Convert fileList to alias list if necessary
set aliasList to {}
repeat with aFile in fileList
	set end of aliasList to aFile as alias
end repeat

-- Call the function with the list of file aliases
openCompositeInPhotoshop(aliasList)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 07, 2024 Mar 07, 2024

Copy link to clipboard

Copied

You can add filetype filters like this: 

{"psd", "psb"}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 07, 2024 Mar 07, 2024

Copy link to clipboard

Copied

LATEST

@pwurso 

 

Thanks for posting!

 

As there is no way to do this with ExtendScript (nor with UXP), my previous suggestion has been to try 3rd party keyboard macro software.

 

I don't use AppleScript, so it is good to know that for Mac users there is a native option!

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 01, 2021 Nov 01, 2021

Copy link to clipboard

Copied

The alternative is to use Bridge that is going to export layered files into .jpg's (resized if you need).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 01, 2021 Nov 01, 2021

Copy link to clipboard

Copied

Thanks, we have a process that uses Javascript in CS6 and we want the files to open the composite data so it can be handled with the older version. Would be interesting to see if we could implement the workflow using Bridge.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 01, 2021 Nov 01, 2021

Copy link to clipboard

Copied

In lastest CC releases there's (improved) Export panel for it. In CS6 you need to use scripting.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2021 Nov 03, 2021

Copy link to clipboard

Copied

You can do the Export directly from Lightroom. It only works with the flat composite, and batching is what Lightroom was born to do. Select all the files, and ctrl+shift+E.

 

Lightroom exports to PSD, TIFF, jpeg or png, resized or not.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines