Forum Discussion

valentine's avatar
valentine
Contributor
14 years ago

Accessing the 'Start - run' window in xp

Is there a way I can access 'run' window in xp, windows 2003, vista etc. in Testcomplete.



I have some line of code:

LatestBuildPath = "<Newtwork server>\\Thefilename.msi";

p1 = Sys.WaitProcess("Explorer", 100000);

w1 = p1.Window("Shell_TrayWnd");

w1.Window("Button", "Start").ClickButton();

p1.Window("DV2ControlHost", "Start Menu").Window("DesktopSFTBarHost", "", 2).Window("SysListView32")["ClickItem"]("Run...", 0);



p1.Window("#32770", "Run").Window("ComboBox").Window("Edit").Keys(LatestBuildPath + "[Enter]");

Delay(20000);

p1.Window("#32770", "Open File - Security Warning", 1).Window("Button", "&Run", 1).ClickButton();


Delay(10000);



--> when I run this in 'windows server 2003' It works fine.

Opens the '.ms' file and runs it.

--> when I run it in 'windows xp': It doesnt .

 

Is the another way to run an msi file.

I even added the file path to the TestedApps, but when I call it to run it generate an error "Unsable to run..."

7 Replies


  • Hi Valentine,





    You can use the code below to run an *.msi file:



      var WShell = Sys.OleObject("WScript.Shell");

      WShell.Run("\"C:\\the needed file.msi\"");







    See this MSDN article for more information.


  • Hi Allen ,



    I have added that code snippet to a method:

    function RunCmdPrompt(whatToRun){

    1. var WShell = Sys.OleObject("WScript.Shell");

    2. WShell.Run(whatToRun);

    3. Delay(5000);

    4. return;

    }



    --> The issue is when I call this method with the "<file.msi>", it stops short at line 2, after the msi file is open.

    So I can't seem to proceed with TestComplete to read the 'installation window'.

    ...


    RunCmdPrompt(themsiFileName);

    p1 = Sys.WaitProcess("msiexec",20000);

    if(p1.Exists){

    ...



  • found a workaround from microsoft site



    :msiexec /i x:\support\tools\suptools.msi /q



    Modified the method to read:

    function RunCmdInstallationFile(TheInstallationFile)

    {

    var WShell = Sys.OleObject("WScript.Shell");

    PathAndMsi = "msiexec /i " + TheInstallationFile;// +" /q ";

    Retaurnvallue = WShell.Run(PathAndMsi);

    Delay(5000);

    return;

    }



    Removed the quite stuff...

    --> This opens and runs an ".msi" file...

  • scsvel's avatar
    scsvel
    Frequent Contributor
    function RunCmdPrompt(whatToRun){

    1. var WShell = Sys.OleObject("WScript.Shell"); 

    2. WShell.Run(whatToRun); 

    3. Delay(5000);

    4. return;

    }





    Have you passed full absolute path of the msi file with filename and extension as "whatToRun"? I think it will work.
  • Hi Shanmugavel,

    as to my earlier post, I said that it works... after I found a solution from microsoft site...
  •  Could you please tell me which object should i use to invoke script (Share Folder)to run in test complete tool with  some example. 



     
  • Hi dhanapal bala,

    could you be a bit clarifying in your message.