Showing results for 
Show  only  | Search instead for 
Did you mean: 

Insert images into descriptor from Macro


Insert images into descriptor from Macro


in our Website we want to add a new descriptor, but it's content needs to be generated by a Macro. Now the problem is that when we try to include images, the HTML output includes hard links to images (Such as <img src="c:\program files (x86)\MEGA\.."/>)


In a website descriptor we can use [Variable=StdFile File="...."/] to make the Website generator copy the relevant image and create a relative link (Such as <img src="../images/appl.gif"/>). This works fine but the Macro-generated images do not get converted. Is there a Macro equivalent of calling [Variable=StdFile File="..."/] in a Website generation context? We want to use this to replace the hard links and create a working website.

1 Reply

Re: Insert images into descriptor from Macro

Hello alros,


you can try this in your macro :


Sub Generate(oObject, oContext, sUserData, sResult)

  Dim oRoot, oWebsite

  Set oRoot = oObject.GetRoot
  Set oWebsite = oContext.Website

  sResult = "<h2><img src=" & Chr(34)


  If oWebsite Is Nothing Then
    sResult = sResult & oContext.StdFileCopy("appl.gif","","")

    sResult = sResult & oContext.StdPath(1,False) & oContext.StdFileCopy("appl.gif","","")

  End If


  sResult = sResult & Chr(34) & " alt=" & Chr(34) & "Softwares" & Chr(34) & " style=" & Chr(34) & "vertical-align:middle;" & Chr(34) & "/>&nbsp;Softwares</h2>"


End Sub

Best regards,