Forum Discussion

Rammherz's avatar
Rammherz
Occasional Contributor
7 years ago

How to obtain process object of just launched cmd

Hi there,

I have one cmd instance launched (#1), and then I run one more instance (#2):

 

    var obj = Sys.OleObject("WScript.Shell")
    obj.Run("C:\\Users\\admin\\run_sql.bat")

After it I need to obtain run_sql.bat output. I do following:

 

    var p = Sys.Process("cmd");
    var w = p.Window("ConsoleWindowClass", "*");
    var txt = w.wText;

But I get output of cmd instance #1 instead of just created instance.

Please help me to get correct process object

  • cunderw's avatar
    cunderw
    7 years ago

    When you try to run your PL/SQL script in test complete via an ADO connection and it fails, what is the failure you are seeing? Perhaps we can more easily work that out and you would then have a more robust way of generating your orders with parameters? 

  • I found out that ADO connection can`t work with multiple PL/SQL blocks in one script. Like this:

    variable a  number;
    variable b  number;
    
    def a = x;
    def a = y;
    
    begin
    ....
    end;
    /
    
    begin
    ....
    end;
    /

    So I changed this to:

    declare
    a  number := x ;
    b  number := y ;
    
    begin
    
    begin
    ....
    end;
    
    
    begin
    ....
    end;
    
    end;

    And it helped! Now I can run my script via ADO, so I don`t need to run shell.

    Thanks for all advices!

     

    • Rammherz's avatar
      Rammherz
      Occasional Contributor

      tristaanogre, cunderw, thanks a lot!

       

      Actually these are my first steps in automation testing, some my decisions can be really silly.

       

      I'll try to explain what I want to do.

      I have complex PL/SQL scipt with many 'begin' blocks and script variables. This script creates invoice in Oracle EBS and performs few more actions.

      Off curse it would be great for me to run this script via ADO connection, I have all prepared structure for it. But it fails. I tried whole day to run it, I looked for decisions here and in google, but now I`m not sure it is possible.

      So I installed SQL*PLUS and created .bat file which will run that PL/SQL scipt. And now I`m trying to run it using SQL*PLUS. Also there are parameters in this script, and actually I want to have ability to change them... But now I hardcoded all parameters and just try to run script and get output.

      In output of script there is generated name of created invoice. I need it for further work. So I need to obtain output somehow.

       

      Well, that`s it. Maybe you can suggest some new decision for my goals. Thanks!

       

      P.S. Sorry for my english, hope you will understand this text :)

      • cunderw's avatar
        cunderw
        Community Hero

        When you try to run your PL/SQL script in test complete via an ADO connection and it fails, what is the failure you are seeing? Perhaps we can more easily work that out and you would then have a more robust way of generating your orders with parameters? 

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    I would add your run_bat as a TestedApp in your project and then call the TestedApp Run method to execute it.  That method returns the process that was just created.