Forum Discussion

t_nguyen's avatar
t_nguyen
Occasional Contributor
12 years ago

Defining Variables for a path in an explorer window

Hello, Here is a little background on my scenario:



I have recorded hundreds of scripts and what is common between these test scripts is they involve opening a explorer window and typing in a path such as: "P:\0001-Test Complete\Project\ProjectFile.txt"



The problem I have is that the "0001-Test Complete" folder stored centrally on a P drive will require a new code assigned every year. So as of next year the folder will need to be renamed to "0002-Test Complete". This will mean that I need to go through all my scripts and change what is typed into the explorer window to: "P:\0002-Test Complete\Project\ProjectFile.txt"



Is there an easier way I can do this such as defining once the path and then use it as a variable in all my scripts so that next year I only need to change it once and the variables defined in each script does the rest?



Thank you in advance for any assistance
  • Hi Thanh,

    You have to change the following statment with the ProjectSuitVariable.

     comboBoxEx32["SetText"]("P:\\0001-Test Complete\\SFCL-13-62.502 - Test Complete\\");





    comboBoxEx32["SetText"]("P:\\0001-Test Complete\\SFCL-13-62.502 - Test Complete\\");



    Assuming that , you have defined a ProjectSuit Variable named PV_var and assingned "P:\\0001-Test Complete\\SFCL-13-62.502 - Test Complete\\" value to it.



    So your code would be like this

    comboBoxEx32["SetText"](ProjectSuit["Variables"]["PV_Var"]));



    [There might be few syntax erros in the above code as I do not have TC right now with me.]



    For more information , please refer the link below:

    http://support.smartbear.com/viewarticle/28298/ 

  • vajindarladdad's avatar
    vajindarladdad
    Frequent Contributor
    Hi Thanh,

    You have to change the following statment with the ProjectSuitVariable.

     comboBoxEx32["SetText"]("P:\\0001-Test Complete\\SFCL-13-62.502 - Test Complete\\");





    comboBoxEx32["SetText"]("P:\\0001-Test Complete\\SFCL-13-62.502 - Test Complete\\");



    Assuming that , you have defined a ProjectSuit Variable named PV_var and assingned "P:\\0001-Test Complete\\SFCL-13-62.502 - Test Complete\\" value to it.



    So your code would be like this

    comboBoxEx32["SetText"](ProjectSuit["Variables"]["PV_Var"]));



    [There might be few syntax erros in the above code as I do not have TC right now with me.]



    For more information , please refer the link below:

    http://support.smartbear.com/viewarticle/28298/ 

  • t_nguyen's avatar
    t_nguyen
    Occasional Contributor
    Hi Vajindar



    Thanks for your reply. I have read through the section you linked me too but it still doesnt really help me. Either that or I am not understanding it right. Here is a example of the type of test I am running:




    function Test1()


    {


      var explorer;


      var msctls_progress32;


      var comboBoxEx32;


      var edit;


      explorer = Aliases["explorer"];


      explorer["wndStart"]["ClickButton"]();


      explorer["wndDV2ControlHost"]["DesktopSpecialFolders"]["SysListView32"]["ClickItem"]("Computer", 0);


      msctls_progress32 = explorer["wndComputer"]["WorkerW"]["ReBarWindow32"]["AddressBandRoot"]["msctls_progress32"];


      msctls_progress32["BreadcrumbParent"]["ToolbarWindow32"]["ClickItemXY"]("Desktop", 11, 9, false);


      comboBoxEx32 = msctls_progress32["ComboBoxEx32"];


      edit = comboBoxEx32["ComboBox"]["Edit"];


      comboBoxEx32["SetText"]("P:\\0001-Test Complete\\SFCL-13-62.502 - Test Complete\\");


      edit["Keys"]("[Enter]");


      explorer["wndCabinetWClass"]["Close"]();


    }



    The part where I type the folder path "0001-Test Complete" is the bit that would change every year and would be great if I can replace that with something more global. I hope this is more specific.



    Many thanks

  • t_nguyen's avatar
    t_nguyen
    Occasional Contributor
    Varjindar you are a legend. Thanks for sorting that so quickly. Works a treat