Below is a simplified version of what I'm using to accomplish this...
'This is a script to determine if file actually exists.
dim path as xpTextObject
Scene.GetObjectByName("PATH", path)
Dim fs As Object = CreateObject("Scripting.FileSystemObject")
Dim defaultImagePath As String = path.Text & "MISC\Default_Player.png"
Dim imagePath As String
imagePath = path.Text & triCode.Text & "\" & lname.Text & "_" & fname.Text & ".png"
If Not(fs.FileExists(imagePath)) And fs.FileExists(defaultImagePath) Then
engine.DebugMessage("Headshot " & imagePath & " doesn't exist. Setting to default player photo instead.", 1)
imagePath = defaultImagePath
End If
'set Volatile Texture
dim HS as xpBaseObject
Scene.GetObjectByName("Headshot", HS)
HS.SetVolatileTextureFile(0, imagePath)
#XPression