Forum Discussion
You should use either Eval() (for VBScript and, possibly, for JScript/C#Script/C++Script) or evaluate() (for DelphiScript) function provided by the corresponding scripting language that you are using for the tests. See the documentation for the scripting language for more details. (Note: C#Script and C++Script are actually JScript with modified syntax, so you should read JScript documentation is you use any of these languages.)
For the VBScript the code will be like this:
strObject = "Sys.Process(""Notepad"")"
Set obj = Eval(strObject)
For DelphiScript the code will be like this:
strObject := 'Sys.Process(''Notepad'')'
obj := evaluate(strObject)
How should we achieve the same using python in Testcomplete. I understand evaluate() and Eval() can be used for jscript and delphy.
Can somebody please help on this. its an urgent requirement.
- tristaanogre7 years agoEsteemed Contributor
Quick google search found that Python supports an "eval()" method as well. have you tried that?
- adithyasekar7 years agoOccasional Contributor
yes . but it didnt work.
Query in detail: I trying to automate notepad.
enter some value in notepad.
the workspace path is = Aliases.notepad2.wndNotepad
if am trying to enter the value as = Aliases.notepad2.wndNotepad.Keys("Hello world"), then it is entering the word . but when i put the path in excel and trying get the path from excel and trying to enter value like = DDT.CurrentDriver.Value["columnName"].Keys("Hello world") >> then its throwing error as string doesnt have keys attribute.
please help in resolving this.
- tristaanogre7 years agoEsteemed Contributor
As mentioned, you need to use eval. I don't know Python so the syntax may be off. But, this is what I would do
var myObject; myObject = eval(DDT.CurrentDriver.Value["columnName"]); myObject.Keys('Hello World');