Chapter 3 DynaScript Predefined Objects


system methods

The system object has these methods:

Exec method

Syntax

system.Exec(cmd)

Description

Executes a command outside the Dynamo Script Interpreter.

Return

Boolean. Returns true or false indicating whether or not the call succeeded:

Example

This example launches the Windows Notepad utility.

<--SCRIPT
// Launches notepad
system.Exec( "notepad.exe" );
-->

GetCWD method

Syntax

system.GetCWD( )

Description

Returns the current working directory.

Return

String.

Example

To return the current directory:

<!--SCRIPT
// Prints the current working directory
document.WriteLn( system.GetCWD() );
-->

GetEnv method

Syntax

system.GetEnv(env)

Description

Searches the environment for an environment entry matching env , and returns its value.

Return

String or null if no matching entry found.

Example

This example retrieves the environment's PATH entry:

<!--SCRIPT
path = system.GetEnv( "PATH" );
-->

SetEnv method

Syntax

system.SetEnv(env,value,overwrite)

Description

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 .

Example

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 © 1999 Sybase, Inc. All rights reserved.