Open a file using wildcards
Hi All,
I am somewhat familiar with scripting but have never scripted in photoshop (forgive my newbie ignorance). I prefer to use VBA if possible. I have run into a few problems getting started. I have quite a few images inside a folder. I want to open only the images that contain a certain string ("*shadow"). I've successfully opened the file using the exact path and filename, but have not been able to figure out how to open the file using widcards or directories. I tested my directory structure by creating a dummy folder called "Renders_Edited" and the folder is created in the location I would expect. But I can't seem to get it to open a file unless I use the exact path.
I've tried a number of different approaches. I'm including some of them below. Thanks in advance to anyone who takes the time to help a beginner.
Sub Main()
LayerFiles "C:\Rendermation\"
End Sub
Sub LayerFiles(strFolder)
Dim ObjPhotoshop
Dim fso, folder, files, folderIdx
Dim arrFileType
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(strFolder)
Set files = folder.files
Set ObjPhotoshop = CreateObject("Photoshop.Application")
If Not FolderExists(strFolder & "\" & "Renders_Edited") Then
MkDir strFolder & "\" & "Renders_Edited"
End If
For Each folderIdx In files
arrFileType = Split(folderIdx.Name, ".")
If IsArray(arrFileType) Then
If arrFileType(UBound(arrFileType)) = "png" Then
'ObjPhotoshop.Open "C:\Rendermation\bluestone_Flair_Channel_Cushion_R_3-4X3-4.3dm_Shadow.png"
' ObjPhotoshop.Open & Chr(34) & strFolder & folderidx.name & Chr(34)
ObjPhotoshop.Open "& Chr(34) & strFolder & folderIdx.Name & Chr(34) "
' ObjPhotoshop.Open "C:\Rendermation\Renders\" & "*Shadow"
End If
End If
End Sub
