Scripting the Ps <--> Lr exchange

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

miked

Scripting the Ps <--> Lr exchange

Post by miked »

I'm curious if anyone has tried handling communication between Lr and Ps. I've never done anything in lua (which is what Lr uses according to the SDK) and before I start down the rabbit hole (if I even need to) I have some conceptual questions.

For automation to work, three things have to be true:

1. Ps must be able to detect when the file it's receiving is coming from Lr,
2. Ps must be able to run an action when a file from Lr is received, and
3. Ps must be able to send the file back to Lr.

If #1 is possible, then it follows that whatever script does this detection can also call the action in question. So #2 is handled.
And Lr detects that Ps has saved the file and reloads it automatically, more or less, which handles #3.
So the entire operation hinges on #1. Can anyone think of how it can be detected if Lr has sent the file to Ps?

There would have to be some smarts built into this because when the file is opened in Ps, Ps would have to know to run a script and would have to know to *only* run the script if it came from Lr and not just File, Open or whatever.

For example, I can detect files sent from bridge using this code

Code: Select allif (app.playbackParameters.hasKey(app.stringIDToTypeID('filesList'))) { ...}

Any help is greatly appreciated.
xbytor

Scripting the Ps <--> Lr exchange

Post by xbytor »

Checkout photoshop.jsx (I forget where it's located). There are functions in there for Lr integration that may help you out.
csuebele

Scripting the Ps <--> Lr exchange

Post by csuebele »

In Windows for PS CC 2014 the photoshop.jsx file is at: C:\Program Files (x86)\Common Files\Adobe\Startup Scripts CC\Adobe Photoshop.

I've modified that file to integrate Bridge with PS, so I can start a PS script with selected files in Bridge. I haven't tried it with LR. There are some global variables you can use to detect if files are opened from Bridge or LR. That file consist of a bunch of functions that make the different scripts work with each other, so you just need to create new functions, using the ones there as a base.
miked

Scripting the Ps <--> Lr exchange

Post by miked »

Thanks guys. I found it in

/Library/Application Support/Adobe/Startup Scripts CC/Adobe Photoshop/photoshop.jsx