DBWSetValueInMemory

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Library Reference > PDMSystem >

DBWSetValueInMemory

Description

This sub allows to store into memory a string value linking it to a key string as in a hashtable.

Syntax

Sub DBWSetValueInMemory(memoryKeymemoryValue)

Remarks

The values are serialized at each assignment and are therefore available across sessions and also after rebooting the workstation.
If you want to avoid reading values from a previous session, make sure that the first operation associated with memory values in a new session of DBWorks is of type SET and not of type GET (the value being set is not relevant to this goal).

Please note the values written into memory with .VBS code is not readable through a .NET API code and viceversa.

See also

DBWGetValueFromMemory Function

Ways to access memory

Example

This example show the persistency of the set value even when script is expired.
The variable is set in file named first.vbs; then is read by the script named second.vbs

First.vbs

Sub main()
 dbwinit(TRUE)
 msgbox "This is the SETTING script"
 res=DBWInputBox ( "Enter a value to write in memory" , input_string )
 if res=TRUE then DBWSetValueInMemory "mykey", input_string
End Sub

Second.vbs

Sub main()
 dbwinit(TRUE)
 msgbox "This is the CALLING script"
 myvar=DBWGetValueFromMemory("mykey")
 msgbox myvar
End Sub