It looks like you ".dll" file is actually a text file, so you can use the
textstream methods to read it. I see a few problems causing the script to
fail. First, you do not Dim scsvW in the function. Second, you Dim sbatch in
the function but not in the main program. This means the value of sbatch is
not visible in the main program. You should NOT Dim sbatch in the function,
and instead Dim sbatch in the main program. This makes it a global variable
visible everywhere.
I would recommend using "Option Explicit" which would make this easier to
troubleshoot. Also, you call your function as if it were a subroutine.
That's OK, it works, but functions generally return a value. You could
design the function to return sbatch, or whatever program should be run.
Having sbatch be a global variable will also work. Finally, when you run the
program it might be better to explicitly call the command processor. For
example:
shell.run "%comspec% /c " & sbatch
However, your version should work as well.
--
Richard Mueller
MVP Directory Services
Hilltop Lab -
http://www.rlmueller.net
--
"LucasYew" <> wrote in message
news:...
>
> Hi Pegasus,
> Thanks for your reply.
>
> maybe i give you example to clear the doubt
>
> Eg: .dll file
> BATCHFILE=D:\ExchangeField_Extraction\ADExch_Expor ting_Field.bat
> RCSVFILE=D:\ExchangeField_Extraction\E2K3AD_field. csv
> WCSVFILE=D:\ExchangeField_Extraction\E2K3AD_field1 .csv
>
>
> Eg: .vbs file getting the value from .dll file
> Dim objFSO, shell
> Call getInfo()
> set shell=createobject("wscript.shell")
> shell.run sbatch
> set shell=nothing
>
> Function getInfo()
> Dim fso, sbatch, scsv, tstream, sline, sPara,iLen
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set tstream =
> fso.OpenTextFile("D:\ExchangeField_Extraction\path Changes.dll")
>
> Do Until not tstream.AtEndOfStream
> sline = tstream.ReadLine
> sPara = "BATCHFILE"
> iLen = Len(sPara)
> If Left(sline, iLen) = sPara Then
> sbatch = Right(sline, Len(Trim(sline)) - iLen - 1)
> WScript.Echo sbatch & "sub"
> End If
>
> sPara = "RCSVFILE"
> iLen = Len(sPara)
> If Left(sline, iLen) = sPara Then
> scsv = Right(sline, Len(Trim(sline)) - iLen - 1)
> End If
>
> sPara = "WCSVFILE"
> iLen = Len(sPara)
> If Left(sline, iLen) = sPara Then
> scsvW = Right(sline, Len(Trim(sline)) - iLen - 1)
> End If
> Loop
> tstream.Close
> End Function
>
>
> --
> LucasYew
> ------------------------------------------------------------------------
> LucasYew's Profile: http://forums.techarena.in/members/76919.htm
> View this thread: http://forums.techarena.in/server-scripting/1177796.htm
>
> http://forums.techarena.in
>