How to make a default file template in PrimalScript.

When you create a new file in PrimalScript you have several options:

1. Click on the File New button in the toolbar
2. Click the little arrow next to it to create a specific type of file
3. Select File – New… and choose a specific type form the menu
4. Press Ctrl+N to create a new empty file

Number 1 and 4 usually pop up the following dialog when used the first time:


If you click yes you can select a default template.

Now, we all know, in the midst of a hectic work day if some pesky dialog pops up we are quick to click “No”, “Cancel”, “Abort”, “Go Away” or whatever option we get to not have to deal with it. If there is a “Do not show this dialog again” option we are glad to take it.

But fear not. If you have done that and Ctrl+N just produces an empty type-less file instead of the great PowerShell file template you made, there is a way to this manually since PrimalScript 2.0:

  • Navigate to your template folder. Under Windows 7 that usually is “C:\ProgramData\SAPIEN\PrimalScript 2011\Templates” You can cheat by looking at Tools – Options – Environment – Directories. It’s the one that says “Templates:”
  • Create a file called “Default.ps1” and edit it to your liking. The extension determines the type. You can just copy the PowerShell.ps1 file from “File Templates\Script Files” if you like.
  • Adjust the encoding to your liking. All 2011 templates are Unicode or UTF-8 depending on type. But you can save the file with whatever encoding you prefer and when you create a new file it will be picked up.

That’s it. Press Ctrl+N now and you get a PowerShell file right away.