Forum Discussion

ciscowaas's avatar
ciscowaas
Occasional Contributor
15 years ago

Recording a script using windows keyboard shortcuts

Hi,



I am trying to automate the following testcase using windows keyboard shortcuts, so that this script can run on different Windows OS



Testcase:

   > Access a share directory and copy a file to local pc . Start->Run->\\x.x.x.x\share. For this step, I am using windows keyboard shortcut "win logo + R" to open Run . This operation is done on Win7 pc

In the recorded script, I am seeing that it saves the above "win logo + R" operation as "[Win]r " Now, when I try to re-run this code, it doesn't open RUN, instead, it performs [WIN] - start and then in the search box it enters 'r'



Can someone please help me figuring out what is a better way to open RUN without a mouse click or if you can tell me what is keyboard equivalent for the same ?



Script recorded is as follows:



function Test1()

{

  var explorer;

  var comboBox;

  var edit;

  var wndtesting;

  var directUIHWND;

  Aliases.cmd.wndConsoleWindowClass.Keys("[Win]r");


  explorer = Aliases.explorer;

  comboBox = explorer.dlgRun.ComboBox;

  comboBox.SetText("\\\\1.1.1.1\\testing");

  edit = comboBox.Edit;

  edit.Keys("[Enter]");

  wndtesting = explorer.wndCabinetWClass1;

  wndtesting.testing.DUIViewWndClassName.DirectUIHWND.CtrlNotifySink.ShellView.DirectUIHWND.DblClick(88, 142);

  directUIHWND = wndtesting.ats_cifs_exploratory_test.DUIViewWndClassName.DirectUIHWND.CtrlNotifySink.ShellView.DirectUIHWND;

  directUIHWND.Click(49, 80);

  directUIHWND.ClickR(49, 80);

  directUIHWND.PopupMenu.Click("Copy");

  directUIHWND.Keys("[Win]r");

  comboBox.SetText("C:\\");

  edit.Keys("[Enter]");

  wndtesting.ShellTabWindowClass.DUIViewWndClassName.DirectUIHWND.CtrlNotifySink.ShellView.DirectUIHWND.Keys("^v~[F4]");

  directUIHWND.Keys("~[F4]");

}





Thanks !

Ali

3 Replies

  • ciscowaas's avatar
    ciscowaas
    Occasional Contributor
    Thanks Jackson. That works for "[Win]r"

    How about copy/past using shortcuts ? The original code had "^v", it doesn't work complaining object not found. So, I added [Hold], but still the same problem.





      wndtesting.ShellTabWindowClass.DUIViewWndClassName.DirectUIHWND.CtrlNotifySink.ShellView.DirectUIHWND.Keys("^v");





    Appreciate your help





    -Ali
  • ciscowaas's avatar
    ciscowaas
    Occasional Contributor
    I re-recorded the test again and it worked this time. I didn't have to do [Hold] and [Release] for CTRL key as it was only one key after CTRL



    Thanks the guide you pointed out was helpful



    -Ali