{"id":3603,"date":"2011-11-29T13:51:09","date_gmt":"2011-11-29T21:51:09","guid":{"rendered":"http:\/\/www.sapien.com\/blog\/?p=3603"},"modified":"2011-11-29T14:11:23","modified_gmt":"2011-11-29T22:11:23","slug":"how-to-make-a-default-file-template-in-primalscript","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2011\/11\/29\/how-to-make-a-default-file-template-in-primalscript\/","title":{"rendered":"How to make a default file template in PrimalScript."},"content":{"rendered":"<p>When you create a new file in PrimalScript you have several options:<\/p>\n<blockquote>\n<p>1. Click on the File New button in the toolbar <br \/>2. Click the little arrow next to it to create a specific type of file <br \/>3. Select File \u2013 New\u2026 and choose a specific type form the menu <br \/>4. Press Ctrl+N to create a new empty file<\/p>\n<\/blockquote>\n<p>Number 1 and 4 usually pop up the following dialog when used the first time:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"SNAGHTML1d507ca8\" border=\"0\" alt=\"SNAGHTML1d507ca8\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2011\/11\/SNAGHTML1d507ca8.png\" width=\"455\" height=\"188\"><\/p>\n<p>If you click yes you can select a default template.<\/p>\n<p>Now, we all know, in the midst of a hectic work day if some pesky dialog pops up we are quick to click &#8220;No&#8221;, &#8220;Cancel&#8221;, &#8220;Abort&#8221;, &#8220;Go Away&#8221; or whatever option we get to not have to deal with it. If there is a &#8220;Do not show this dialog again&#8221; option we are glad to take it.<\/p>\n<p>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:<\/p>\n<ul>\n<li>Navigate to your template folder. Under Windows 7 that usually is &#8220;C:\\ProgramData\\SAPIEN\\PrimalScript 2011\\Templates&#8221; You can cheat by looking at Tools \u2013 Options \u2013 Environment \u2013 Directories. It&#8217;s the one that says &#8220;Templates:&#8221;\n<li>Create a file called &#8220;Default.ps1&#8221; and edit it to your liking. The extension determines the type. You can just copy the PowerShell.ps1 file from &#8220;File Templates\\Script Files&#8221; if you like.\n<li>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.<\/li>\n<\/ul>\n<p>That&#8217;s it. Press Ctrl+N now and you get a PowerShell file right away.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 \u2013 New\u2026 and choose a specific type form the menu 4. Press Ctrl+N to create [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[27,283,410],"tags":[692,691,28,37],"class_list":["post-3603","post","type-post","status-publish","format-standard","hentry","category-ask-the-experts","category-howto","category-primalscript-software-news","tag-default","tag-file-type","tag-powershell","tag-primalscript"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/3603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=3603"}],"version-history":[{"count":2,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/3603\/revisions"}],"predecessor-version":[{"id":3605,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/3603\/revisions\/3605"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=3603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=3603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=3603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}