1

I'm writing to call a VBScript from Silk bdh and passing arguments from Silk. My first problem is there are more than 1 argument (total 4 arguments). My second problem is these arguments contain white space.

Below is the program:

sCmdLine := "cscript.exe";
//sParms := "C:\\QK\\test1_old.vbs \"   \""  +string(error_counter)+"\" \"" +error_timer  ; 
sParms := "C:\\QK\\test1.vbs \" 2\string(error_counter)+ 

error_timer+error_details+error_time;

hProcessId := ProcessInitialize(sCmdLine, PROCESS_PIPED, sParms,"C:\\WINDOWS\\System32\\");
ProcessSetOutputBuffer(hProcessId, reportedTo, STRING_COMPLETE);
ProcessStart(hProcessId);
StrSearchDelimited(reportedTo,STRING_COMPLETE,reportedTo,"reserved.",1,NULL,1,STR_SEARCH_FIRST);
print("reportedTo*****"+reportedTo); 

VBS program is:

dim captcha

errorcounter=Wscript.Arguments(0)
errortimer=Wscript.Arguments(1)
errordetails=Wscript.Arguments(2)
errortime=Wscript.Arguments(3)

text= "Level : " & errorcounter
text= text & vbNewline
text = text & "Page : " & errortimer
text= text & vbNewline
text = text & "Error : " & errordetails
text= text & vbNewline
text = text & "Error Time : " & errortime

reportedto=inputbox( text,"ReportedTo")
tehlexx
  • 2,821
  • 16
  • 29
  • The syntax and `BDH` indicate that you are referring to `Silk Performer` rather than `Silk Test`, correct? – tehlexx Mar 31 '14 at 13:42

1 Answers1

0

You always quote parameters with spaces. This is basic Windows and was introduced 19 years ago. With the exception of chdir and notepad, all other commands and code that parses command lines expect things containing spaces to be quoted.

dir "c:\some folder\some file.txt" /a

In vbs we would write the above string to execute as (chr(34) is a quote char)

"dir " & chr(34) & "c:\some folder\some file.txt" & chr(34) & " /a"
tony b
  • 1
  • 2