Forum Discussion

jeetendra_mitta's avatar
jeetendra_mitta
Occasional Contributor
10 years ago
Solved

How to run any command while execution has been started and used the break point

After execution has been started if the user wants to update any variable's value, he or she uses the break point and update the value uisng "Evaulate" dialog. But if user want to run any expression in same situation, how he or can will do as QTP uses Command promt of debug viewer, please suggest.

5 Replies

  • jeetendra_mitta's avatar
    jeetendra_mitta
    Occasional Contributor
    Thanks for your valuable information, but if I want to execute msgbox "Hello", i am facing problem becasue there are " (two times).
  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Simply enter:



    - it's an Eval'able function call.



    In a general case, you need to double the quotes inside the string:

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    You can run commands in the Evaluate dialog, too. Enter the command in the Expression text box. If the command returns a value, you'll see it in the Result box.
  • jeetendra_mitta's avatar
    jeetendra_mitta
    Occasional Contributor
    Suppose I missed to declare any variable and already started the execution. This time I use the breakpoint and tries to run the command "Dim var_name", I get syntax error in Resutls field. But in QTP we can easily do that operation.
  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Ah, I see what you mean. The reason for this is that the Evaluate dialog works like Eval, not like Execute. So, you get an error for "Dim varname" because Eval("Dim varname") causes an error in VBScript.



    To run arbitrary statements, wrap them in Execute():



    By the way, unless you use Option Explicit, Dimming variable is optional (although, recommended). If a script uses an unDimmed variable, the VBScript engine will automatically create this variable in the global scope.