gget79
28th November 2009, 00:23
Hi Friends,

I am working with LN 6.1 FP3, with bw 8.5 version.


I have used the solution posted in this forum talking about send mails with Visual basic code.

My first attempt was in Baan V and It worked fine for me, but now I am making in the LN and it isn't working for me, appears me a Windows script host message. It tell me "Not specified a script".

My source code is


function extern enviar_email()
{
long ret
string commandline(2560)

frmTo = g.destinatario
frmSubject = g.subject
frmBody = g.body
frmAtt = g.ruta

varfrom = """" & frmFrom & """"
varto = """" & frmTo & """"
varsubject = """" & frmSubject & """"
varbody = """" & frmBody & """"
varcat = """" & "" & """"
varbcc = """" & "" & """"
varcc = """" & "" & """"
varatt = """" & "C:\BaanEma\tmp\outlook.pdf" & """"
varaction = """send""" | or copy or save or send cfr script below

commandline = "C:\vbbaan\Outlook.vbs " & varfrom & " " & varto & " " & varsubject & " " & varbody & " " & varcat & " " & varbcc & " " & varcc & " " & varatt & " " & varaction
commandline = "Outlook.vbs " & varfrom & " " & varto & " " & varsubject & " " & varbody & " " & varcat & " " & varbcc & " " & varcc & " " & varatt & " " & varaction |get.n
ret = app_start(commandline,"C:\vbbaan","","/home/get/out.txt","/home/get/errstd.txt") |get.n
}

My VBS is:

Dim obj, nCount, i, vfrom, vto, vsubject, vbody, vcat, vbcc, vcc, vatt, vaction

'nCount = WScript.Arguments.Count
'wscript.echo ncount
'for i = 0 to nCount-1
' wscript.echo Wscript.Arguments(i)
'next

vfrom = cstr(Wscript.arguments(0))
vto = cstr(Wscript.arguments(1))
vsubject = cstr(Wscript.arguments(2))
vbody = cstr(Wscript.arguments(3))
vcat = cstr(Wscript.arguments(4))
vbcc = cstr(Wscript.arguments(5))
vcc = cstr(Wscript.arguments(6))
vatt = cstr(Wscript.arguments(7))
vaction = cstr(Wscript.arguments(8))

set obj = CreateObject("VBBAAN.BAANVB")
i = obj.sendBaanEmail(cstr(vfrom), cstr(vto), cstr(vsubject), cstr(vbody), cstr(vcat), cstr(vbcc), cstr(vcc), cstr(vatt), cstr(vaction))

set obj = Nothing


Attach message.