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
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-with-all-smart-objects-paths/idc-p/12689475)
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 pho
...
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
I've also been looking for a way to find the locations and names of my linked files in Photoshop, but for some reason it doesn't work for all files. I have several .mov-files in my photoshop document and when I click on it the properties simply show "no properties". How can I find out the name and location of the mov file? When I dragged it into photoshop it automatically was assigned a layer number instead of keeping its name.
Copy link to clipboard
Copied
@Danny51 – Are you sure that the .mov isn't embedeed?
When I drag-n-drop a .mov from the Finder into a Photoshop doc, it is embedded, not linked.
Embedded:
Linked:
Copy link to clipboard
Copied
So when I drag a move file into an existing photoshop file it gives me a video layer. And if I then turn it into a smart object, it is embedded but still needs a source file - It happened to me that I moved or deleted video files and then photoshop asked me to relink those files - even though they were embedded?
How can I actually get video layers to be IN the document without having to keep a million source files?
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