Is there any such concept as "global variables" in TestComplete? I have a situation where a global would come in handy (global timeout value), but haven't been able to dig up any info regarding global variables from the help files.
It's just a matter of declaring your global variables outside of the body of any procedure or function. I do this in a unit called Global (surprise, surprise), which I include in other units via a uses statement,
There are two ways that we've used in our projects to do this. First, you can use project variables (see help topic on "Local Variables"). However, I think there is some limitation as to what you can store in these (for example, I don't think you can store object references here like a Sys.Process object).
The other way that we use is to have a code unit that contains only variable declarations (we call it "CommonVar"). I don't know if this is possible in other scripting languages but in DelphiScript we have a unit of code that looks like this:
<font class="small">Code:</font><hr /><pre>
p, //Global Process Variable
w, //Global Window Variable
WScriptObject; //Global object reference for WScript.Shell object</pre><hr />
We then, in almost all our other units of code, have at the beginning something like: