Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
the script of sg test on windows
[simgrid.git] / examples / gras / timer / test_sg.vbs
1 Dim oShell
2 Dim sInstallDirectory   ' The install directory of the simulator Simgrid
3 Dim sCurrentDirectory   ' The current directory of the script
4 Dim sCommandLine                ' The command line of the application to launch
5 Dim iExitCode                   ' The exit code of the application to launch
6
7 Set oShell = WScript.CreateObject ("WSCript.shell")
8 Set oUseEnv = oShell.Environment("USER")
9
10 ' Get the install directory of Simgrid from the environment variable SG_INSTALL_DIR 
11 sInstallDirectory = oUseEnv("SG_INSTALL_DIR")
12 sCurrentDirectory = GetCurrentDirectory()
13 ' Construct the command line of the application to launch
14 sCommandLine = "cmd /K " & sCurrentDirectory & "bin\timer_simulator " & sInstallDirectory & "\simgrid\examples\msg\small_platform.xml " & sCurrentDirectory & "timer.xml"
15
16 iRetVal = oShell.run(sCommandLine,1,True)
17
18 Set oShell = Nothing
19 Set oWshShell = Nothing
20
21 ' This function returns the directory of the script
22 Function GetCurrentDirectory()
23         Dim sScriptFullName 
24         
25         sScriptFullName = WScript.ScriptFullName
26         GetCurrentDirectory = mid(sScriptFullName,1,InStrRev(sScriptFullName,"\"))
27         
28 End Function
29