Proof Colors

Upload Adobe Bridge Scripts, Download Adobe Bridge Scripts, Support for Individual Adobe Bridge Scripts

Moderators: Tom, Kukurykus

User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Proof Colors

Post by Kukurykus »

In the Photoshop there is 'View / Proof Setup'. If you choose one it selects also 'View / Proof Colors' and change visually colors of your opened image. It's useful when you want to check how possibly your image may look after printing on certain printer you use. Other words that you see on your screen in the set Photoshop profile isn't that what be seen on hard copy, as printers may have their specific color profiles.

This script let you to open image(s) in Photoshop that you selected by Bridge browser. As the result, written earlier by you proof colors to the script will be applied to current image at the time it's beeing opened.



Instructions:
  • close Photoshop and Bridge
  • copy script to StartupScripts Bridge folder, for ex. C:\Program Files\Common Files\Adobe\Startup Scripts CS6\Adobe Bridge
  • if you don't have your own .psf file, use that attached to post, dprint.psf and copy to: C:\Users\User\AppData\Roaming\Adobe\Color\Proofing
  • open script in ExtendScriptToolKit, find the 'mawi' word and change it to the name of your computer, that you want .psf file was opened on
  • if you have created by Photoshop ('View / Proof Setup') your own .psf file or got it from other source, find in the script 'dprint' name and change it to yours
  • if you are going to use this script on other computer where you want to open files with other Proof Colors, find in the script 'proofCyan' name and change it to other (if you are not sure of scripting name of that proof color then choose one from 'View / Proof Setup' and copy appropriate name from ScriptListenerJS.log present on your desktop). Here script must be copied to StartupScripts Bridge folder as well
  • launch Bridge and select some image(s), right click on one of selected one(s) and from the bottom of the command list click the newest: Proof Colors. Files will be successively opening with proof colors

There are four versions of this script. I use the 4th, however 3rd written other way gives exactly same result.
Versions 2 (with environment variable) and version 1 (with time delay) are worse and work other way.

Proof Colors.rar
(573.68 KiB) Downloaded 684 times
Version 4: (with suggestion of SuperMerlin from Photoshp Scripting Adobe forums)

to open files from Bridge I used scriptable 'File / Open With' command. This time to check path, there was used Folder.startup command. It's the simplest and final method!

Code: Select all

#target bridge

BT = '(function BT(v1, v2) {bt = new BridgeTalk(), bt.target = v1, \
bt.body = v2, bt.onResult = function(v) {return res = v.body} bt.send(2)})'

while(typeof res == 'undefined') {
eval(BT + "('photoshop', 'File(decodeURI(Folder.startup)).fsName')")
}
pc = new MenuElement('command', 'Proof Colors', 'at the end of Thumbnail')

RES = res, pc.onSelect = function() {
for(i = 0; i < eval((sel = 'app.document.selections') + 'Length'); i++) {
if ((spec = (seli = eval(sel)[i]).spec) instanceof File) {

seli.openWith(RES + '/photoshop.exe')

function pc() {
function sTT(v) {return stringIDToTypeID(v)} eval("(dsc1 = new ActionDescriptor())" +
".put" + (!/mawi/i.test($.getenv('COMPUTERNAME')) ? "Enumerated(sTT('builtin'), " +
"sTT('builtinProof'), sTT('proofCyan'))" : "String(sTT('name'), 'dprint')"))
executeAction(sTT('proofSetup'), dsc1, DialogModes.NO); return activeDocument.name
}

while (File.decode(spec.name) != res) {
eval(BT + "('photoshop', '(' + " +
pc.toString() + " + ')' + '()')")
}

}
}
}
Version 3: (with help of r-bin from Photoshp Scripting Adobe forums)

to open files from Bridge I used scriptable 'File / Open With' Command. But this time to check path, there was used .js script (created by our .jsx) which checks in registry current Photoshpo path. Then it saves it in temporary system folder that .jsx script can read it and use. Full (2 versions) script for checking Photoshop paths (I modified to implement into mine) you find in this theard: https://forums.adobe.com/thread/2421907

Code: Select all

#target bridge

cmd = '(pth = (fso = new ActiveXObject("Scripting.FileSystemObject"))' +
'.GetSpecialFolder(2).CreateTextFile("photoshoppath", true, true))\n' +
'.WriteLine((WScript.CreateObject("WScript.Shell")).RegRead("HKLM\\\\SOFTWARE\\\\' +
'Microsoft\\\\Windows\\\\CurrentVersion\\\\App Paths\\\\Photoshop.exe\\\\Path"))\n' +
'pth.Close(), fso.GetFile(fso.GetSpecialFolder(2).Path + "\\\\tmp.js").Delete()'

function rw(v1, v2, v3) {v2.open(v1), v1 < 'w' ? v3 = v2.read() : v2.write(v3), v2.close(); return v3}
function FLE(v) {return File(Folder.temp.fsName + '\\' + v)} rw('w', fle = FLE('tmp.js'), cmd)
fle.execute(), pth = res = rw('r', fle = FLE('photoshoppath')).replace(/\n/, ''), fle.remove()

pc = new MenuElement('command', 'Proof Colors', 'at the end of Thumbnail')

pc.onSelect = function() {
BT = '(function BT(v1, v2) {bt = new BridgeTalk(), bt.target = v1, \
bt.body = v2, bt.onResult = function(v) {return res = v.body} bt.send(2)})'

for(i = 0; i < eval((sel = 'app.document.selections') + 'Length'); i++) {
if ((spec = (seli = eval(sel)[i]).spec) instanceof File) {

seli.openWith(pth + 'photoshop.exe')

function pc() {
function sTT(v) {return stringIDToTypeID(v)} eval("(dsc1 = new ActionDescriptor())" +
".put" + (!/mawi/i.test($.getenv('COMPUTERNAME')) ? "Enumerated(sTT('builtin'), " +
"sTT('builtinProof'), sTT('proofCyan'))" : "String(sTT('name'), 'dprint')"))
executeAction(sTT('proofSetup'), dsc1, DialogModes.NO); return activeDocument.name
}

while(File.decode(spec.name) != res) {
eval(BT + "('photoshop', '(' + " + pc.toString() + " + ')' + '()')")
}

}
}
}
Version 2:

to open files from Bridge I used scriptable 'File / Open With' Command. Unfortunately I found that when your Photoshop isn't launched, then Bridge is launching Photoshop. And when that happends then getenv('Path') command used from Bridge in Photoshop by BridgeTalk command to check current application path is getting incorrect path. So it gives you Bridge path instead of Photoshop path, as Pthotoshop was ran not from system but Bridge (beeing this way kind of Bridge process). Well if you reopen Bridge problem will be held as well as if you close then Photoshop and open it agian from Bridge. If finally you close Photoshop, but this time open it from system, nothing will change as opened previously Bridge will see previous session of Photoshop. The only you can do is to close both programs and open both from system in order: Photoshop and Bridge, what if not accomplished will be alerted by script. Ps. you may also open Photoshop and then choose 'File / Browse in Bridge'. It will work as well.

Code: Select all

#target bridge

BT = '(function BT(v1, v2) {bt = new BridgeTalk(), bt.target = v1, \
bt.body = v2, bt.onResult = function(v) {return res = v.body} bt.send(2)})'

if (ps = BridgeTalk.isRunning('photoshop')) {
while(typeof res == 'undefined') {
eval(BT + "('photoshop', '$.getenv(" + '"Path"' + ")')")
}
RES = res
}

pc = new MenuElement('command', 'Proof Colors', 'at the end of Thumbnail')

pc.onSelect = function() {
if (!ps || res.match(RegExp(an = app.name, 'i'))) {
alert('To run this script close both Bridge and Photoshop to ' +
'reopen them (in order Photoshop and then Bridge) from your system!')
}

else {
for(i = 0; i < eval((sel = 'app.document.selections') + 'Length'); i++) {
if ((spec = (seli = eval(sel)[i]).spec) instanceof File) {

seli.openWith(eval('Array(' + RES.replace(/(.*?);/g, "\'$1\', ").replace(/\\/g, '/') + ')')[0] + 'photoshop.exe')

function pc() {
function cTT(v) {return charIDToTypeID(v)}; function sTT(v) {return stringIDToTypeID(v)}
eval("(dsc1 = new ActionDescriptor()).put" + (!/mawi/i.test($.getenv('COMPUTERNAME')) ?
"Enumerated(sTT('builtin'), sTT('builtinProof'), sTT('proofCyan'))" : "String(sTT('name'), 'dprint')"))
executeAction(sTT('proofSetup'), dsc1, DialogModes.NO); return activeDocument.name
}

(function nme() {
eval(BT + "('photoshop', '(' + " + pc.toString() + " + ')' + '()')"); if (File.decode(spec.name) != res) nme()
})()

}
}
}
}
Version 1:

to open files from Bridge I used scriptable 'File / Open' Command. What's bad I found that when your Photoshop isn't launched and you want to open some image(s) by Bridge during first 10 seconds. It opens them in Windows image browser, or if not any is set then ask you what program with you'd like to open them. If this situtaion is met, a workaround makes script checks how many seconds left to full 10 from time you lunched Bridge and alert appropriate information.

Code: Select all

#target bridge

BT = '(function BT(v1, v2) {bt = new BridgeTalk(), bt.target = v1, \
bt.body = v2, bt.onResult = function(v) {return res = v.body} bt.send(2)})'

ini = eval(gT = '(new Date).getTime()'), pc = new MenuElement('command',
'Proof Colors', 'at the end of Thumbnail'), eval(RES = 'res = undefined')

pc.onSelect = function() {
if ((ad = app.document), (tme = eval(gT) - ini) < n = 10000) {
arr = ad.getSelection(), txt = "Bridge's initiation takes another: "
+ ((wait = n - tme) / (n / 10)) + " sek!", (win = new Window ('palette' )).margins = 15
win.add('statictext', undefined, txt), win.show(), $.sleep(wait), win.close(), ad.refresh()
for(len = arr.length, i = 0; i < len; i++) ad.select(ARR = arr.shift())
}
else {
for(i = 0; i < eval((sel = 'ad.selections') + 'Length'); i++) {
if ((spec = (seli = eval(sel)[i]).spec) instanceof File) {

seli.open(); function pc() {
function cTT(v) {return charIDToTypeID(v)}; function sTT(v) {return stringIDToTypeID(v)}
eval("(dsc1 = new ActionDescriptor()).put" + (!/mawi/i.test($.getenv('COMPUTERNAME')) ?
"Enumerated(sTT('builtin'), sTT('builtinProof'), sTT('proofCyan'))" : "String(sTT('name'), 'dprint')"))
executeAction(sTT('proofSetup'), dsc1, DialogModes.NO); return activeDocument.name
}

(function nme() {
eval(BT + "('photoshop', '(' + " + pc.toString() + " + ')' + '()')"); if (File.decode(spec.name) != res) nme()
})()

}
}
eval(RES)
}
}