0

I am trying to write a VBscript to call a batch file. Something what I am able to do from Command prompt but i failed to do the same from VBscript.
From cmd:

C:\PR\PS\build\bin>execDl.bat Jack > History.txt \n 
Jack> getHistory 50008 Dl \n
quit

I could call the 1st step from the script but i fail to understand how to do the 2nd and third step. till now my script

dim shell
dim ID 
ID ="50008"
dim Deal 
Deal ="Deal"
dim UserName 
Deal ="admin"
dim OutputPoint 
OutputPoint =">"
dim batchFileFolder
batchFileFolder = "C:\PR\PS\build\bin\"
set shell=createobject("wscript.shell")
strRun = batchFileFolder & "execDl.bat admin " & OutputPoint _
   & batchFileFolder & "output1.txt" & """"
shell.run(strRun)
set shell=nothing

Any help is highly appreciated.

c:\PR\PS\build\bin>execDl.bat admin ------> gives out below output in command prompt and then the cursor points to admin
Current User is: tswan


Welcome to FlowEngine Prototype command line interface.
For a listing of valid commands, (enter "help" at prompt.


admin> getHistory 7006 Dl

Activity History for Document: 7006

Process submitted on: 2010-05-19 00:55:59.56
Process id: 3
Submitter: swang

Activity Name Resource Action Completion Date Comments


Submit tswan Submit 2010-05-19 00:55:59.937 Deal Manager tswan Approve 2010-05-19 00:56:26.013 Approved Completed 2010-05-19 00:56:26.027

getHistory "7006 Dl" has been successfully completed.


this is the overall sequence of commands I follow in command prompt and the one i have mentioned at the top is the three step command to redirect output to the text file.

My doubt is how do i execute the rest of the step that includes getHistory and the quit statement from vb script. :( @Mr Fuzzy Button Thanks for formatting it. I am new to stackoverflow way of posting.

Thanks

Mayu
  • 27
  • 1
  • 6

1 Answers1

0

Basically, you need to get the commands you would normally type at the FlowEngine prompt into a file and then redirect standard input from this file. Something like:

dim fso
dim f
dim cmd
dim shell
dim inpFile
dim outFile
inpFile = "execInput.txt"
outFile = "execOutput.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile( inpFile , 2, True)
f.Write "getHistory 50008 Deal" & vbCrLf & "quit" & vbCrLf
f.close
set shell=createobject("wscript.shell")
cmd = "execDeal.bat admin < " & inpFile & " > " & outFile
shell.run( cmd )
set shell=nothing
TripeHound
  • 2,721
  • 23
  • 37