Copy link to clipboard
Copied
Hi everyone,
what a learning curve with this photoshop integration. It is very interesting but also a little bit frustrating.
I got some smart objects and the end goal is to change the linked file locations.
But first I need to know what the current location is.
Has anyone got some very simple code that does it?
Even better if it is VBScript or a bonus point for vb.net but I will take what I can get.
Thanking you very kindly.
Henry
Copy link to clipboard
Copied
I am not script guy. There is requested info on Window > Properties panel, just ensure that linked Smart Object is selected in the Layers panel then open Window > Properties and you should see file location.
Copy link to clipboard
Copied
Actually, I did not know that. I was always baffled on how to see that. That will come in handy.
But need to be able to script the whole thing. Something like 30 objects per page x 40 something pages and growing.
Just silly for me to manually.
Copy link to clipboard
Copied
@henry22453428ow9z wrote:
I got some smart objects and the end goal is to change the linked file locations.
But first I need to know what the current location is.
Has anyone got some very simple code that does it?
app.runMenuItem(stringIDToTypeID('placedLayerEditContents'));
alert(decodeURI(activeDocument.path) + "/" + activeDocument.name);
exiftool -XMP-xmpMM:IngredientsFilePath 'Mac path to/file.psd'
or
exiftool -IngredientsFilePath "Win path to\file.psd"
Copy link to clipboard
Copied
Firstly thanks to everyone for your help. It was a very painful process but without your help it would of been impossible.
I followed the links over to (https://community.adobe.com/t5/photoshop-ecosystem-ideas/is-there-an-option-that-shows-me-a-list-wit...
went through the jscript(??) and slowly translated it vb.net. Very interesting language, very easy to follow. I thought it might be helpful to other people so I posted my code.
top of the class
imports photoshop
following in a button action, class, function etc...
Dim ref
Dim applicationDesc
Dim theNumber
Dim layerDesc
Dim isSmartObject
Dim theSO
Dim theLink
Dim ps_app As New Photoshop.Application
ref = New ActionReference
ref.putProperty(ps_app.StringIDToTypeID("property"), ps_app.StringIDToTypeID("numberOfLayers"))
ref.putEnumerated(ps_app.CharIDToTypeID("Dcmn"), ps_app.CharIDToTypeID("Ordn"), ps_app.CharIDToTypeID("Trgt"))
applicationDesc = ps_app.ExecuteActionGet(ref)
theNumber = applicationDesc.getInteger(ps_app.StringIDToTypeID("numberOfLayers"))
Dim m = 0
Dim n = 0
Do While m <= theNumber
ref = New ActionReference ' might fall over as it is already declared above
ref.putIndex(ps_app.CharIDToTypeID("Lyr "), m)
layerDesc = ps_app.ExecuteActionGet(ref)
isSmartObject = layerDesc.hasKey(ps_app.StringIDToTypeID("smartObject"))
If isSmartObject = True Then
theSO = layerDesc.getObjectValue(ps_app.StringIDToTypeID("smartObject"))
If theSO.getBoolean(ps_app.StringIDToTypeID("linked")) = True Then
theLink = theSO.getPath(ps_app.StringIDToTypeID("link")) ' this will give the path
End If
End If
m = m + 1
Loop
Copy link to clipboard
Copied
Nice job - thanks for sharing vbscript code, unusual for this forum!
Moderator - remove extra ')' character from end of link posted by user.
Copy link to clipboard
Copied
Yeah, I have not seen much vb code here. There was a bit of a learning process and as I looked over the scripting guide, it seemed so simple and straightforward. But I guess once you know then you know.
Good luck to the next vb scripter, hopefully I have been helpful and given a little bit back.
Copy link to clipboard
Copied
sTT = stringIDToTypeID; (ref = new ActionReference())
.putProperty(sTT('property'), sO = sTT('smartObject'))
ref.putEnumerated(sTT('layer'), sTT('ordinal'), sTT('targetEnum'))
executeActionGet(ref).getObjectValue(sO).getPath(sTT('link')).fsName