Chapter 3 DynaScript Predefined Objects
Provides functionality for interacting with the server's operating system environment.
To use a system property:
system.propertyName
To use a system method:
system.MethodName( parameter )
The system object is provided for you.
This example modifies the system path.
<--SCRIPT // Adds e:\src to the Environment System Path path = system.GetEnv( "PATH" ); path = path + "e:\src;"; system.SetEnv( "PATH", path, true ); -->
system.errorNumber
This property is read-only.
A number [integer] representing the error code of the last system method call.
This example displays an error code:
<!--SCRIPT document.WriteLn( system.errorNumber ); -->
system.errorString
This property is read-only.
A string containing an error message for the error code of the last system method call. This is a read-only property.
This example displays an error message:
<!--SCRIPT document.WriteLn( system.errorString ); -->
system.Exec(cmd)
Executes a command outside the Dynamo Script Interpreter.
Boolean. Returns true or false indicating whether or not the call succeeded:
This example launches the Windows Notepad utility.
<--SCRIPT // Launches notepad system.Exec( "notepad.exe" ); -->
system.GetCWD( )
Returns the current working directory.
String
To return the current directory:
<!--SCRIPT // Prints the current working directory document.WriteLn( system.GetCWD() ); -->
system.GetEnv(env)
Searches the environment for an environment
entry matching env
, and
returns its value.
String or null if no matching entry found
This example retrieves the environment's PATH entry:
<!--SCRIPT path = system.GetEnv( "PATH" ); -->
system.SetEnv(env,value,overwrite)
Searches the environment for an entry matching env
.
If there is no such entry, an entry is created and set to value
;
otherwise, if overwrite
is
true the entry is set to value
.
This example modifies the system path.
<!--SCRIPT // Adds e:\src to the Environment System Path path = system.GetEnv( "PATH" ); path = path + "e:\src;"; system.SetEnv( "PATH", path, true ); -->
Copyright © 2001 Sybase, Inc. All rights reserved. |