Indexes   

SystemService (Object)

Represents an object which provides system services.

Method Index

Environ
Returns the value of an environment variable.
Evaluate
Evaluates a scripted function.
ExecuteBackgroundProcessus
Executes an asynchronous process.
ExecuteProcessus
Executes a synchronous process.
ExecuteScript
Executes a scripted function.
Print
Prints a string on stdout.

Methods


o Func Environ( iEnvString) As
Returns the value of an environment variable.
Parameters:
iEnvString
The name of the environment variable
Example:
This example retrieves the value of the PATH variable in the Value string.
 Value = CATIA.SystemService.Environ("PATH")
 
o Func Evaluate( iScriptText,
iLanguage,
iFunctionName,
iParameters) As
Evaluates a scripted function.
Parameters:
iScriptText
The program text
iLanguage
The language the program is written in
iFunctionName
The name of the function to invoke
iParameters
An array of parameters for the function
oResult
The value returned by the function (if any)
Example:
This example executes the function CATMain from the CodeToEvaluate string
 Dim params()
 Dim codeToEvaluate
 CodeToEvaluate = "Sub CATMain()" & vbNewLine & _
                  "MsgBox " & chr(34) & "Hello World" & chr(34) & vbNewLine & _
                  "End Sub"
 CATIA.SystemService.Evaluate CodeToEvaluate, CATVBScriptLanguage, "CATMain", params
 
o Func ExecuteBackgroundProcessus( iExecutablePath) As
Executes an asynchronous process. This process is launched in background and ExecuteBackgroundProcess doesn't wait for it to complete. If the executable to run needs a specific environment to works correctly (for example environment variables like PATH or LD_LIBRARY_PATH correctly set), this environment must have been set in order to make this method succeed. If this executable needs to be launched from a window, this method will fail.
Parameters:
iExecutablePath
The path of the executable to run and its arguments If the executable is not present in the PATH environment variable, you must specify its complete absolute path. If this path contains blanks, you must enclose it with the simple quote character ''' : for example CATIA.SystemService.ExecuteBackgroundProcess "'C:\Program Files\myApp\myApp.exe' myArg".
Returns:
Non significative return code. It's never the asynchronous process return code
Example:
This example executes the command located at
and doesn't wait the end of its execution.
 CATIA.SystemService.ExecuteBackgroundProcessus ""
 
o Func ExecuteProcessus( iExecutablePath) As
Executes a synchronous process. If this process is succesfully launched, ExecuteProcessus waits for it to terminate and returns the process return code. If the executable to run needs a specific environment to works correctly (for example environment variables like PATH or LD_LIBRARY_PATH correctly set), this environment must have been set in order to make this method succeed. If this executable needs to be launched from a window, this method will fail.
Parameters:
iExecutablePath
The path of the executable to run and its arguments. If the executable is not present in the PATH environment variable, you must specify its complete absolute path. If this path contains blanks, you must enclose it with the simple quote character ''' : for example CATIA.SystemService.ExecuteProcessus "'C:\Program Files\myApp\myApp.exe' myArg".
Returns:
The synchronous process return code
Example:
This example executes the command located at
waits for it to end, and returns its return code.
 ReturnCode = CATIA.SystemService.ExecuteProcessus("")
 
o Func ExecuteScript( iLibraryName,
iType,
iProgramName,
iFunctionName,
iParameters) As
Executes a scripted function.
Parameters:
iLibraryName
The library in which the script is contained
iLibraryType
The type of the library
iProgramName
The name of the program in the library
iFunctionName
The name of the function to invoke
iParameters
An array of parameters for the function
oResult
The value returned by the function (if any)
Example:
This example executes the function CATMain in the program Macro1.catvbs contained by Part1.CATPart
 Dim params()
 CATIA.SystemService.ExecuteScript"Part1.CATPart", catScriptLibraryTypeDocument, "Macro1.catvbs", "CATMain", params
 
o Sub Print( iString)
Prints a string on stdout.
Parameters:
iString
The string to print
Example:
This example prints the string "Hello world!".
 CATIA.SystemService.Print("Hello world!")
 

Copyright © 2006, Dassault Systèmes. All rights reserved.