From: SeeYouAgainBye on 24 Jul 2006 00:15 Hello, The problem was fixed ! I added <?xml version="1.0"?> to top of the sample.wsf file, then the script acts as i expected, without any error. The fixed source code of sample.wsf is below. <?xml version="1.0"?> <job id="sample1"> <script language="VBScript.Encode" src="func.vbe"></script> <script language="VBScript"> Dim str str = func("aaa") WScript.Echo(str) </script> </job> And additional info, if 3rd line is changed shown below, the error ocurred. I feel strange, maybe a bug WSH. Case1: change "script" to "Script" <Script language="VBScript.Encode" src="func.vbe"></Script> ^ ^ then sample.wsf returns strange error below. sample.wsf(6, 6) Microsoft VBScript runtime error: Type mismatch: 'func' Case2: change "language" to "Language" <script Language="VBScript.Encode" src="func.vbe"></script> ^ then sample.wsf returns strange error below. sample.wsf(1, 2) Microsoft JScript compilation error: Invalid character Any idea or comment is welcome. Regards, seeyouagainbye(a)hotmail.com SeeYouAgainBye wrote: > Thank you Babu, > but it returned an error. > > I changed > <script language="VBScript.Encode" src="func.vbe"></script> > to > <script language=VBScript.Encode src="func.vbe"></script> > then the error shown as below. > > sample.wsf(3, 19) Windows Script Host: Expecting an attribute value enclosed in quotes > > Any comment or idea? > > Regards, > seeyouagainbye(a)hotmail.com > > > Babu VT wrote: >> Hi, >> >> To encode script within a .wsf file, below is the format ,but WITHOUT QUOTES >> in language value ... >> >> <language=VBScript.Encode src="encodedfile.vbe"> >> >> rgds >> Babu >> >> "SeeYouAgainBye" <SeeYouAgainBye(a)hotmail.com> wrote in message >> news:ei282yirGHA.5032(a)TK2MSFTNGP02.phx.gbl... >>> Thank you Michael, >>> but it does not work after changing as you said. >>> The error message is changed to below: >>> >>> sample.wsf(0, 1) Windows Script Host: The parameter is incorrect. >>> >>> I continue to try to fix but currently cannot... >>> The source code as follows: >>> >>> sample.wsf: >>> >>> <job id="sample1"> >>> <script language="VBScript.Encode" src="func.vbe"></script> >>> <script language="VBScript"> >>> Dim str >>> str = func("aaa") >>> WScript.Echo(str) >>> </script> >>> </job> >>> >>> func.vbs: >>> >>> Function func(strInput) >>> func = strInput & " is inputted." >>> End Function >>> >>> (func.vbe is created from func.vbs with screnc.exe.) >>> >>> Any comment or idea? >>> >>> Regards, >>> seeyouagainbye(a)hotmail.com >>> >>> >>> Michael Harris (MVP) wrote: >>>> SeeYouAgainBye wrote: >>>>> Hello, >>>>> Does anyone know how to call vbe from wsf ? >>>>> vbe is encoded vbscript file with screnc.exe. >>>>> >>>>> I make func.vbs and sample.wfs. >>>>> sample.wfs code is like below. >>>>> >>>>> <Job id="sample1"> >>>>> <Script Language="VBScript" src="func.vbs"></Script> >>>>> <Script Language="VBScript"> >>>>> Dim str >>>>> str = func("aaa") >>>>> WScript.Echo(str) >>>>> </Script> >>>>> </Job> >>>>> >>>>> The sample.wfs works as i expected. >>>>> But I encode func.vbs to func.vbe, and change sample.wfs line 2 as >>>>> below. >>>>> >>>>> <Script Language="VBScript" src="func.vbe"></Script> >>>> <Script Language="VBScript.Encode" src="func.vbe"></Script> >>>> >>>> >>>>> Then sample.wfs said error below. >>>>> >>>>> sample.wsf(1, 2) Microsoft VBScript compilation error: Expected >>>>> statement >>>>> >>>>> note that screnc.exe was download from below: >>>>> http://www.microsoft.com/downloads/details.aspx?FamilyID=e7877f67-c447-4873-b1b0-21f0626a6329&DisplayLang=en >>>>> >>>>> Regards, >>>>> seeyouagainbye(a)hotmail.com >> |