executeSilent
Syntax
executeSilent(SourceCode:string [,Parameter, ...]) |
The function executeSilent receives a string and interprets it as though it were the source code of a method.
The function executeSilent accepts all statements. The anonymous identifier ? refers to the Method object that called the executeSilent function. The anonymous identifier @ is received by the calling method.
The semantics of executeSilent is as follows:
When the string method does not have a return value, executeSilent returns VOID.
Example
var objPath : string := "Track"
var attrName: string := "Length"
var attrVal : length := 3.5
executeSilent(to_str(objPath, ".", attrName, ":=", attrVal))
When the string method has a return value, these may look as follows:
When the string method contains a syntax error, executeSilent returns VOID.
Example
executeSilent("-> integer; 1+") -- returns VOID
When a runtime error occurs while the string method is executed, executeSilent returns the default value of the corresponding type, i.e., the value of a local variable of this type would have at the beginning of the execution of the method. Note that Plant Simulation does not open the Debugger when a runtime error occurs, but continues to be executed. Use the function execute to make Plant Simulation open the Debugger, when runtime errors occur. For example, the executeSilent-statement below returns false because assigning the keyword "if" to the name of an object causes a runtime error.
Example
executeSilent("->boolean; Station.name := \"if\"; return true")
-- returns false because of a runtime error
In all other cases, executeSilent will return the return value of the string method.
Example
executeSilent("->integer; return := 42") -- returns 42
The function executeSilent executes the referenced Method. You can use it to execute methods that you referenced via variables. Let us say you save a method to a variable obj of data type object, you can now call this method using obj.executeSilent.
Example
param obj: object, new_name: string |
Be aware that the variant
executeSilent("->boolean; " + obj + ".name := \"" + new_name + "\"; return true") |
does not work, when obj points to a method.
The syntax which is used in the argument for the executeSilent function has to be the same as the Method syntax which calls the executeSilent function.
Related Topic
Related Topics
Miscellaneous Global Functionsanimation
applicationHome
applicationVersion
callEvery
checkForLicense
checkID
clearConsole
clearLogFile
closeAllWindows
closeConsole
closeHTMLWindow
closeModel (open model)
computeSHA1Hash
computeSHA3Hash
connectAutomatically
createLicenseFile
currentEventCtl
deleteAllDebugExpressions
enableFullScreenMode
execute (function)
existsFile
existsMethod
existsObject (2D)
exitApplication
getCallStack
getCommandLineArg
getFileModificationDateTime
getLibraryFiles
getLibraryVersionFromFile
getLogFile
getSeedTable
hideBBL
HTMLHelp
isComputerAccessPermitted
isArray
isSet
keepWindowsAlwaysOnTop
language
licenseName
loadModel (function)
makePathRelative
makeRGBValue
messageBox
modelFile
numOfLimitedObjects
openColorSelectBox
openConsole
openHTMLBrowser
openHTMLWindow
openObjectSelectBox
portNumber
processTime
profiler
putValuesIntoTable (attribute of data type string)
resetInitBox
resetProfile
resetRandomNumberStream
saveModel
saveProfile
sendSMTPMail
setAnimationRefreshRate
setAntitheticRandomNumbers
setConsoleFilter
setInfiniteLoopDetectionTimeout
setMUTraceRouteMethod
setRandomSeedCounter
setSeedTable
showStatisticsReport
strHash
throwRuntimeError
updateGUI
userInterfaceLanguage
How do I
getEpsilonsetEpsilon