Forum Discussion

qadude73's avatar
qadude73
Occasional Contributor
5 years ago
Solved

Creating a Script Unit Template

Currently, when a new Script unit is added a blank page is displayed. Since we have a style/formatting guide that includes commented blocks for script headers and function descriptions (see below example), is there a way to create a Script unit template that includes these by default everytime a new Script is added?

 

Example 1 - Script Header

/**************************************

Information about script, inclusions, constants

etc entered here.

**************************************/

Example 2 - Function Header

/*F************************************/

Brief info on function, param, etc entered here

/**************************************/

 

Thanks in advance.

  • I've used the CTRL-J method a LOT in the past, creating the necessary default headers, etc., in a file.  IT doesn't automatically execute when you create a unit but it's a quick keystroke to do so.  

    Alternatively, you could create a default script.sj file that you then use Add -> Existing item to add to your project and then, "Save As..." to save it as a new file name, preserving the original script.sj file.  

2 Replies

  • BenoitB's avatar
    BenoitB
    Community Hero

    No but you have several ways of speeding the things :

    • Ctrl + J in editor to call Code templates and thus you can put quickly in a newly created your own template
    • Build a command line project builder. I've made a standard jscript, ran in command  prompt without the need of TestComplete, which create all the files i need by answering some questions to make it more useful (is it web project ? desktop project ? in closure mode ? only a standalone unit ? ..)

    But yes it would be great to have it directly in TestComplete (an entry in Options module where you can define, according the langage used, your project script template and an entry in New project or Add new file where you check the Use template option)

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      I've used the CTRL-J method a LOT in the past, creating the necessary default headers, etc., in a file.  IT doesn't automatically execute when you create a unit but it's a quick keystroke to do so.  

      Alternatively, you could create a default script.sj file that you then use Add -> Existing item to add to your project and then, "Save As..." to save it as a new file name, preserving the original script.sj file.