Accessing the HTML object of a script field: Script.Utils.GetCSObject() and getCSObject()

At times it is useful to be able to access the HTML object of a script field directly, allowing the use of standard HTML methods and manipulation upon them. Luckily, there is a function that returns the HTML object of the passed script field, in much the same way as document.getElementById() works in a normal HTML document. In Synergy, the Script.Utils.GetCSObject() function is used, whereas in CallScripter 4.5 the getCSObject() function is used. Note the difference in capitalisation between Synergy and CallScripter 4.5.


This could be used to allow the re-styling of a CallScripter element during the script itself. For example, in this case a Synergy script needs to resize a script field during a script run:
Script.Utils.GetCSObject([Styled Field Name]).style.width = "30px";
It also allows the use of .click() to trigger more complex logic and automation within a script. For example, in this case a CallScripter 4.5 script needs to click a particular button when a report runner completes:
if ([Report] == "done") {
Further explanation of this example can be found in the .click() article.