Parker Software Ltd Homepage
Forum Home Forum Home > Email2DB Email Parser > Scripting
  New Posts New Posts RSS Feed: Extracted field value as attachment name
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Extracted field value as attachment name

 Post Reply Post Reply
Author
Message
shane104 View Drop Down
New User
New User


Joined: 25 Jan 2010
Posts: 17
Post Options Post Options   Quote shane104 Quote  Post ReplyReply Direct Link To This Post Topic: Extracted field value as attachment name
    Posted: 10 Mar 2010 at 4:10pm

Hello,
I would like to use an extracted field value for the name of the files I'm creating.

For example, creating a file using the following code.


Sub Main
    Dim FN As Integer
    If Len(Dir("C:\tmp\BrandITEditorFiles\FIELDVALUE.html"))>0 Then Kill "C:\tmp\BrandITEditorFiles\FIELDVALUE.html"
    FN=FreeFile
    Open "C:\tmp\BrandITEditorFiles\FIELDVALUE.html" For Output As FN
    Print #FN,MSG_Body
    Close #FN
End Sub

Alternatively, I could achieve the same by processing an to an email?
The files are then automatically uploaded to the internet as by polling a drive on my PC. - Totally automated.

Any assistance would be much appreciated.

Thanks

Shane

 



Edited by Stephen - 11 Mar 2010 at 9:21am
Back to Top
Stephen View Drop Down
Admin Group
Admin Group
Avatar

Joined: 21 Oct 2005
Location: Stoke on Trent
Posts: 1131
Post Options Post Options   Quote Stephen Quote  Post ReplyReply Direct Link To This Post Posted: 11 Mar 2010 at 9:23am
Hi Shane,
 
In scripts you reference extracted fields using FIELDS_Value("fieldname"). So in your example you would use:
 

Sub Main
    Dim FN As Integer
    If Len(Dir("C:\tmp\BrandITEditorFiles\" & FIELDS_Value("fieldname") & ".html"))>0 Then Kill "C:\tmp\BrandITEditorFiles\" & FIELDS_Value("fieldname") & ".html"
    FN=FreeFile
    Open "C:\tmp\BrandITEditorFiles\" & FIELDS_Value("fieldname") & ".html" For Output As FN
    Print #FN,MSG_Body
    Close #FN
End Sub
 
In all other Email2DB Trigger settings you can use field replacements, %fieldname%.
 
Steve
Back to Top
shane104 View Drop Down
New User
New User


Joined: 25 Jan 2010
Posts: 17
Post Options Post Options   Quote shane104 Quote  Post ReplyReply Direct Link To This Post Posted: 12 Mar 2010 at 9:43am
Many Thanks!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.143 seconds.
These are the forums for Parker Software, developers of Live Chat Software: WhosOn and Email Automation Software: Email2DB.