Forum Discussion

jorgesimoes1983's avatar
jorgesimoes1983
Regular Contributor
10 years ago
Solved

Script Editor Suggestion

Hi! Please see the attachment, i created this thread to suggest a functionality.



I would like to select text, and be able to replace all the spaces by underscores with a mouse click.



It would be a nice functionality.



Please add my request to the database.
  • First of all, the result you want to achieve will be difficult to implement because of the leading spaces (in case of several lines are selected).



    Secondly, you can easily do this by using Replace functionality (see attachment).

8 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi Jorge,



    Here's the script extension that does this:

    ReplaceSpacesWithUnderscores



    Change the file extension to .tcx and double-click to install it into TestComplete. You'll see the new Replace Spaces With Underscores command on the toolbar:





    To keep the extension's code simple, it changes all spaces in the selection including spaces in indents. But, feel free to poke around the source code (the file is a ZIP archive with the code) and change it to suit your needs.



    Disclaimer: This extension is provided "as is", and standard disclaimers apply.
  • karkadil's avatar
    karkadil
    Valued Contributor
    First of all, the result you want to achieve will be difficult to implement because of the leading spaces (in case of several lines are selected).



    Secondly, you can easily do this by using Replace functionality (see attachment).
  • karkadil's avatar
    karkadil
    Valued Contributor
    This is the 1st time I hear such a request :)



    Just curious, why do you need this for?
  • jorgesimoes1983's avatar
    jorgesimoes1983
    Regular Contributor
    Gena, just and idea ;)



    I had to copy/paste names with blank spaces, and it would be nice to replace it by _, although find/replace does the trick.