GetCodeValue

Top  Previous  Next

 

This Special Function is only available to users that hold a Pro License

 

The GetCodeValue Special Function Command allows you to run C# code written in the Code Section from within the script and return the result that the code returns. The code can be anything that you want to write as long as it returns a value of a supported type. The value will be converted to its string representation and assigned as the variable value.

lamp Important: Special Function commands can only be used on the right hand side of a Variable Assignment command.

Command Syntax

 

GetCodeValue:[MethodName],[Parameters]

 

The colon after the command is compulsory. The comma character after the MethodName is only compulsory where Parameters are specified. The GetCodeValue special function itself is not case sensitive, but parameters may be depending on the program, operating system, and locale.

 

Parameters:

 

MethodName: The name of the method to be executed which must have been written in the code section by the user

Parameters: Any parameters to the method line that may be required, separated by commas and surrounded by quotation marks if they are string values.

 

The MethodName parameter is compulsory. The Arguments parameter may or may not be required depending upon the code being run. If any required parameter is missing or invalid an error will be thrown.

 

Supported Data Types

 

The following keywords and data types are supported for parameters:

 

Keyword

.Net Data Type

Size

Example Parameter

 

bool

System.Boolean

1 bit

true

byte

System.Byte

Unsigned 8-bit integer

1

char

System.Char

16 bit

A

datetime

System.DateTime

8 bytes

2021-06-01 00:00:00

decimal

System..Decimal

16 bytes

16.58

double

System.Double

8 bytes

100.00

float

System.Single

4 bytes

75.5

int or int32

System.Int32

Signed 32-bit integer

10

long or int64

System.Int64

Signed 64-bit integer

123456

sbyte

System.SByte

Signed 8-bit integer

1

short

System.Int16

Signed 16-bit integer

1

string

System.String

varies according to string

"This is a string"

uint

System.UInt32

Unsigned 32-bit integer

10

ulong

System.UInt64

Unsigned 64-bit integer

123456

ushort

System.UInt16

Unsigned 16-bit integer

10

 

Example:

 

This example assumes that you have already created a method in the Code Section called GetStringValue:

 

[Test Code Special Function]

 

Var:TrueStatus=GetCodeValue:GetStringValue,true

 

Remark:%%TrueStatus%%

 

[Code]

 

public static string GetStringValue(bool value)

{

   return value ? "It is TRUE" : "It is FALSE";

}

lamp Note: The GetCodeValue special function must always return a value. If you try to use a method that does not provide a return value then it is likely that you will get either an error or unexpected results depending on the code you have written in the script.

See Also: Special Functions GetFileNameVersion GetFileVersion GetRegistryValue CodeResult ExecCode