• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 276
  • Last Modified:

ASP TAG in a vbscript

Hi,

ok i want to call a vbscript sub in asp, but i also want to pass parameters that are var in asp like this

<%
if(NOT rsEmailInterne.EOF) then
'For my mail
 CourrielInterne = CourrielInterne + rsEmailInterne("Courriel")
 rsEmailInterne.MoveNext
 do while(NOT rsEmailInterne.EOF)
  'for the other mail
   CourrielInterne = CourrielInterne + ", " + rsEmailInterne("Courriel")
   rsEmailInterne.MoveNext
 loop
'sub vbscript with asp parameter
%>
<script language="VBScript">
     call EnvoyerMail(<%CourrielInterne%>,<%strMessageInterne%>)
</script>
<%
end if
%>


its that possible to pass a string in asp, to a vbscript sub ???

thx
0
Higor
Asked:
Higor
1 Solution
 
HigorAuthor Commented:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch

the asp error
0
 
aelatikCommented:
Don't know what you mean, ASP uses VBSCRIPT so what do you mean by passing ASP string to VBSCRIPT : Try..

<%
if(NOT rsEmailInterne.EOF) then
'For my mail
CourrielInterne = CourrielInterne + rsEmailInterne("Courriel")
rsEmailInterne.MoveNext
do while(NOT rsEmailInterne.EOF)
 'for the other mail
  CourrielInterne = CourrielInterne + ", " + rsEmailInterne("Courriel")
  rsEmailInterne.MoveNext
loop
'sub vbscript with asp parameter
call EnvoyerMail(CourrielInterne,strMessageInterne)
end if
%>
0
 
AzraSoundCommented:
Add the "=" sign after the "%" sign to indicate a Response.Write


call EnvoyerMail(<%= CourrielInterne %>,<%= strMessageInterne %>)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
CyrexCore2kCommented:
The code above should do what ur talking about except you made a little coding error:

- Start Code -
<%
if(NOT rsEmailInterne.EOF) then
'For my mail
CourrielInterne = CourrielInterne + rsEmailInterne("Courriel")
rsEmailInterne.MoveNext
do while(NOT rsEmailInterne.EOF)
 'for the other mail
  CourrielInterne = CourrielInterne + ", " + rsEmailInterne("Courriel")
  rsEmailInterne.MoveNext
loop
'sub vbscript with asp parameter
%>
<!-- This is your code
<script language="VBScript">

    call EnvoyerMail(<%CourrielInterne%>,<%strMessageInterne%>)
</script> -->
<!-- Put this instead -->
<script language="VBScript">
    call EnvoyerMail(<%=CourrielInterne%>,<%=strMessageInterne%>)
</script>
<%
end if
%>
- End Code -
0
 
HigorAuthor Commented:
It give me 2 error, in vvbscript...

here my sub in vbscript, but i want if its possible to run it from the server, but i think i have some activex problem, because its the error
Server object
Server execution failed....


<script language="VBScript">
     sub EnvoyerMail(Courriel,strMessage)
          Dim myOutlookApli
          Dim mynamespace
          Dim mycontent
               Set myOutlookApli = CreateObject("Outlook.Application")
          Set mynamespace = myOutlookApli.GetNamespace("MAPI")
          Set mycontent = myOutlookApli.Createitem(0)
          mycontent.To = Courriel
          mycontent.Subject ="test"
          mycontent.HTMLBody = strMessage
          mycontent.Attachments.Add "C:\logoBienvenue.jpg"
          mycontent.send
          myOutlookapli.Quit
     end sub
     
</script>
0
 
HigorAuthor Commented:
Server.CreateObject
Server execution failed if i run this code in asp....
0
 
AzraSoundCommented:
That function will run on the client's machine.  If you want it to run on the server you need to return back to the server (via posting the current html page or the like) and running that function on the server within asp tags.

Office automation on the server is not supported by MS, however.  You should look to CDONTS for sending mail from the server.
0
 
HigorAuthor Commented:
ya i know, but the problem with CDONT, is that it use smtp, and my email is on a microsoft exchange server who use MAPI.... i've try with CDONT and it works for external email but not internal....
0
 
HigorAuthor Commented:
also the <%=MyVar> doesnt work he said, invalid carracter....  at a line thats do anything with my sub
0
 
AzraSoundCommented:
>>also the <%=MyVar> doesnt work he said, invalid carracter....  at a line thats do anything with my sub

Then why would it be a problem with the <%= MyVar %> syntax?  I would guess its a problem at the line number specified.

Now that I look at it, if it's a string being passed in, you still need to indicate that in your client script, e.g.,

call EnvoyerMail("<%= CourrielInterne %>", "<%= strMessageInterne %>")
0
 
HigorAuthor Commented:
like this:??? im not suppose to said as string in vbscript....
whats the problem with this?

<script language="VBScript">
     sub EnvoyerMail(courrier,message)
          Dim myOutlookApli
          Dim mynamespace
          Dim mycontent

          Set myOutlookApli = CreateObject("Outlook.Application")
          Set mynamespace = myOutlookApli.GetNamespace("MAPI")
          Set mycontent = myOutlookApli.Createitem(0)
          mycontent.To = courrier
          mycontent.Subject ="test"
          mycontent.HTMLBody = message
          mycontent.Attachments.Add "C:\logoBienvenue.jpg"
          mycontent.send
          myOutlookapli.Quit
     end sub
     
</script>
0
 
HigorAuthor Commented:
<script language="VBScript">
                                                  call EnvoyerMail(<%= CourrielInterne%>,<%= strMessageInterne%>)
                                             </script>

i dont see non valid caracter here also here my var CourrielInter:
CourrielInterne = CourrielInterne + rsEmailInterne("Courriel")
                                             rsEmailInterne.MoveNext
                                             do while(NOT rsEmailInterne.EOF)
                                                  'Pour les mails suivants
                                                  CourrielInterne = CourrielInterne + ", " + rsEmailInterne("Courriel")
                                                  rsEmailInterne.MoveNext
                                             loop
strMessageInterne = "<html><body>" _      
                                             & "<table border=0><tr><td><font size=4 color=#003366>Bonjour et bon lundi, <br><br>" _
                                             & "Cette semaine il y a des anniversaires à souligner!<br> " _
                                             & "DTI vous invite à aller visiter </font><a href='http://proxynt/test_intranet'><font size=4 color=#0099CC>l'intranet</font></a>" _
                                             & " <font size=4 color=#003366> pour connaître les nouveaux jubilés.</font>" _
                                             & "</td></tr></table></body></html>"
0
 
HigorAuthor Commented:
i'm so lost.....
0
 
AzraSoundCommented:
In your asp page, make sure it says this:

call EnvoyerMail("<%= CourrielInterne %>", "<%= strMessageInterne %>")


After you view the page in your browser, view the html source and see what that line actually says and if it complies with what you think you should be seeing.
0
 
HigorAuthor Commented:
lol It was only the missing " " thx a lot!!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now