PDA

View Full Version : Convert VBScript to JavaScript


inview
10-24-2002, 06:02 PM
I'm relatively new to JavaScript and would like to convert the VBScript below to JavaScript. It will execute on the client but will be embedded in an ASP page.

<HTML>
<HEAD>
<TITLE>Label Printing Demo</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2719.2200" name=GENERATOR>
<SCRIPT language=VBScript>
Sub Btn1_onclick()
Dim DymoAddIn, DymoLabel
Set DymoAddIn = CreateObject("DYMO.DymoAddIn")
Set DymoLabel = CreateObject("DYMO.DymoLabels")

DymoAddIn.Open "C:\Program Files\Dymo Label\Label Files\Address (30252, 30320).LWT"
DymoLabel.SetAddress 1,"David Block"+chr(10)+"DYMO Corporation"+chr(10)+"599 W. Putnam Ave."+chr(10)+"Greenwich, CT 06830-6092"
DymoAddIn.Print 1, TRUE
End Sub
</SCRIPT>
</HEAD>
<BODY><BOLD>Label Printing Demo</BOLD>
<P><INPUT type=button value="Print Label" name=Btn1> </P>
</BODY>
</HTML>

glenngv
10-25-2002, 02:44 AM
since that code which uses ActiveX control will only work with IE, converting it to javascript is not necessary.

inview
10-25-2002, 12:52 PM
Thanks for the reply. I'm such a newbie at this - what part makes it an Active X control? Also, if I only wanted to use this in IE, what would need to be done to convert this to JavaScript?

Since I'm doing this in an ASP page, I would like to pass ASP values to this Script - and I find it's easier to do with JavaScript.

jkd
10-25-2002, 04:04 PM
This creates ActiveX objects:

Set DymoAddIn = CreateObject("DYMO.DymoAddIn")
Set DymoLabel = CreateObject("DYMO.DymoLabels")

inview
10-25-2002, 06:11 PM
Thanks for the info.