Forum Discussion
Set ws = Sys.OleObject("WScript.Shell")
ws.Run("c:\somefile.vbs")
- jloyzagawh10 years agoContributor
how would I code the call in jscript?
- HKosova10 years agoSmartBear Alumni (Retired)
jloyzagawh wrote:
how would I code the call in jscript?
var oShell = Sys.OleObject("WScript.Shell"); oShell.Run("C:\\MyFolder\\MyScript.vbs");
- FlossyThePig8 years agoOccasional Contributor
Sorry to resurrect this topic but I am moving from QTP to TestComplete and have a lot of function libraries used in our existing framework. I have tried a simple exercise to try calling a function from a .vbs file but TestComplete fails to see the function. The function works when it is included in the TC script. I feel I've missed something obvious, but what?
Local script:
sub Main()
dim strDay, strWeek
Set ws = Sys.OleObject("WScript.Shell")
ws.Run("C:\string_functions.vbs")
strWeek = "Sun,Mon,Tues,Wed,Thus,Fri,Sat"
'local function
strDay = ChooseStr(strWeek, 3 )
Log.Message ("Day using function ChooseStr = " + strDay)
'external function
strDay = StrChoose(strWeek, 3)
Log.Message ("Day using external function StrChoose = " + strDay)
end sub
Function ChooseStr(ByVal sCSV, ByVal nIndex)
Dim values
values = Split(sCSV,",")
ChooseStr = values(nIndex)
End Function
External file ("C:\string_functions.vbs")
Option Explicit
Function StrChoose(ByVal sCSV, ByVal nIndex)
Dim values
values = Split( sCSV,",")
StrChoose = values(nIndex)
End Function
Related Content
- 13 years ago
- 8 years ago
Recent Discussions
- 17 minutes ago