[thelist] ASP Loop

darren darren at web-bitch.co.uk
Wed Mar 19 04:44:46 CST 2003


On Wednesday, March 19, 2003 at 09:26, Christian Anderson wrote:

CA> Can anyone modify this code to make it just take the first one and then move
CA> on?

i've never used jmail, but the asp is simple.  all you need to do is
replace the for..next loop with an if..end if.

   Function getAttachments()
      Set Attachments = msg.Attachments

      if Attachments.Count > 0 then
         Set at = Attachments(0)
         at.SaveToFile( "c:\hshome\photokyo\blogzilla.jp\attachments\" & at.Name )
         getAttachments = "<a href=""/attachments/" & at.Name &""">" & _
            at.Name & "(" & at.Size & " bytes)</a>"
      end if
   End Function

and...

   Function dbAttachments()
      Set Attachments = msg.Attachments

      if Attachments.Count > 0 then
         Set at = Attachments(0)
         dbAttachments = at.Name
      end if
   End Function

you might want to check that the value of a message with no attachments
is actually 0 and the attachment count is zero based...

hth,

darren.



More information about the thelist mailing list