Forum Discussion

umut_akdemir's avatar
umut_akdemir
Occasional Contributor
11 years ago

UI Responsiveness in Script Extensions - Button handler while script is running

Hi, 



I am writing a design time script extension for test complete. My extension runs a script, and it has a stop running button when it takes too long time. 



The issue I have is when I debug my script via run method before saving it as an extension the stop running button is responsive, changing color when hovered and successfully stops the script when clicked.



However when I install scripts as an extension once I start the inner script with run button the stop running button is not responsive anymore nothing happens when I click and hovering does not change its color. It is as if the UI has a separate thread listening in debug mode and only one thread running as a script extension. 



Is there a way to fix this and have a stop script button? How can I do it?

4 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)
    Hi Umut,

     


    Did you try calling the script extension's methods via [url=Calling Methods Asynchronously


    ]Runner.CallObjectMethodAsync[/url]?


     

  • umut_akdemir's avatar
    umut_akdemir
    Occasional Contributor
    I tried Tanya, yet it didn't work - the reason is written in the help section for the method: 




    CallObjectMethodAsync was added to simplify testing of modal windows and dialog boxes displayed by script routines or by methods that reside in Open Applications. See Testing Modal Windows for complete information.



    ....



    This method cannot be used in script extensions. For more information on objects that you can use in script extensions, see Objects Available to Script Extensions.



    Do you have any other suggestions?


  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)
    Hi Umut,

     


    I wasn't talking about using this method in script extensions. The idea was to call the method declared in the script extension, like this:


    Runner.CallObjectMethodAsync(ExtensionObj, MethodName)


     

  • umut_akdemir's avatar
    umut_akdemir
    Occasional Contributor
    Hi Tanya, 



    Unfortunately in my case it is a design time script extension - when I click on the toolbar item I show a user form. The actions parameters are set in the user form and when the user clicks on the start button it starts running the long running script. 



    In my debugged form I have the stop running option shown and clickable - however all of those are within the modal user form object that is instantiated from the script extension toolbar.



    What I understood from your writing is to declare it in the design time action description.xml - yet I have to show the user, form where he can set parameters and run script, view diagnostics in that action.



    Within that form (which is the user form that is attached to the script extension) is there any way to make this async call as you mentioned - if there is, could you provide some link for it? 



    Thanks a lot