Skip to main content
Inspiring
March 15, 2022
Answered

VBscript place linked image

  • March 15, 2022
  • 1 reply
  • 917 views

Hi everyone,

I am working on a small project which gets a list of image file locations from a DB and then I need to loop through the files and put the images onto the active photoshop document as a linked image.

The first part is easy enough, I found the photoshop scripting guide and cut and paste the Hello world example. 

The only issue I have now is that I need to place the linked image on the active document.

I know that people prefer to program in Javascript to get this job done, but could someone kindly help me out with the VBscript. Thanking you kindly for your help.

Below is the code I have so far:

 

Dim appRef
appRef = CreateObject("Photoshop.Application")

Dim docRef
Dim artLayerRef
Dim textItemRef
docRef = appRef.ActiveDocument

 

'add the image --->>> this is a test file to place it as a linked file
Dim file As String
file = "D:\one_drive\OneDrive\English School\MES\Unit 3\feelings\images\real images\01 Happy.jpg"

 

'???? Now what??? ;(

 

' below is the hello world example

artLayerRef = docRef.ArtLayers.Add
artLayerRef.Kind = 2

' Set the contents of the text layer.
textItemRef = artLayerRef.TextItem
textItemRef.Contents = "Hello, World!"

This topic has been closed for replies.
Correct answer Stephen Marsh

The script listener plug-in can create both JS and VB code on Windows.

 

If VB scripting can play JS code, then it may be possible as a fallback to do the bulk of code in JS and call it from VB.

1 reply

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
March 15, 2022

The script listener plug-in can create both JS and VB code on Windows.

 

If VB scripting can play JS code, then it may be possible as a fallback to do the bulk of code in JS and call it from VB.

Inspiring
March 15, 2022

I understand the concept of what the script listener should do. A bit like the Microsoft macro recorder.

I went to 

https://helpx.adobe.com/photoshop/kb/downloadable-plugins-and-content.html#ScriptingListenerplugin

downloaded and then followed the instructions.

There was a problem but searching through some other sites.

I copied the 

ScriptListener.8li file which was in 

to C:\Program Files\Adobe\Adobe Photoshop CC 2019\Plug-ins\Automate

Then went into photoshop, Help --> system info and saw that ScriptListener was loaded.

Thank you very much this opens a world of possibilities for me.

Inspiring
March 15, 2022

I have the strangest feeling that I have played with this plugin like 15 years ago. I can't even remember what project it was. Maybe a scanning project. But yeah something very familiar about it. Thank you, Stephen so very much for your time and your answer. It has made this job so much easier.