PoshCode Archive  Artifact [5b5cd088a8]

Artifact 5b5cd088a88181a9771c7bc5612739447796e0073710b442a36d180f751bb88c:

  • File New-ISEScript.ps1 — part of check-in [06d42b3e4b] at 2018-06-10 13:41:35 on branch trunk — just a quick re-write of gmagerr’s Powershell Template script to enable his template to create Powershell ISE help-comment based structure which I often use; I just put this function into an add-isemenu custom menu array. Thanks to gmagerr for the structure I just added a couple of things (most of which work fine!). thx for the base gmagerr. (user: biryani size: 3113)

# encoding: ascii
# api: powershell
# title: New-ISEScript.ps1
# description: just a quick re-write of gmagerr’s Powershell Template script to enable his template to create Powershell ISE help-comment based structure which I often use; I just put this function into an add-isemenu custom menu array. Thanks to gmagerr for the structure I just added a couple of things (most of which work fine!). thx for the base gmagerr.
# version: 1.0
# type: function
# author: biryani
# license: CC0
# function: New-ISEScript
# x-poshcode-id: 4477
# x-archived: 2013-10-05T04:41:32
# x-published: 2013-09-18T10:22:00
#
#
Function New-ISEScript
{
$strName = $env:username
$date = get-date -format d
$name = Read-Host "Filename"
if ($name -eq "") { $name="NewScriptTemplate_ISECommentBased" }
$synopsis = Read-Host "Synopsis"
if ($synopsis -eq "") { $synopsis="enter your synopsis of this script activity here" }
$description = Read-Host "Description"
if ($description -eq "") { $description="enter a brief description of this script here" }
$syntax = Read-Host "Syntax"
if ($syntax -eq "") { $syntax="enter syntax here" }
$email = Read-Host "eMail Address"
if ($email -eq "") { $email='myemail@mycompanyemail.com' }
$example1 = Read-Host "Example 1"
if ($example1 -eq "") { $example1="enter example 1 here" }
$example2 = Read-Host "Example 2"
if ($example2 -eq "") { $example2="enter example 2 here" }
$helpurl1 = Read-Host "enter the help url 1 here"
if ($helpurl1 -eq "") { $helpurl1="enter help url 1 here" }
$helpurl2 = Read-Host "enter the help url 2 here"
if ($helpurl2 -eq "") { $helpurl2="enter help url 2 here" }
$seealso1 = Read-Host "See Also 1"
if ($seealso1 -eq "") { $seealso1="enter see also 1 here" }
$seealso2 = Read-Host "See Also 2"
if ($seealso2 -eq "") { $seealso2="enter see also 2 here" }
$seealso3 = Read-Host "See Also 3"
if ($seealso3 -eq "") { $seealso3="enter see also 3 here" }
$comment=@();
while($s = (Read-Host "Comment").Trim()){$comment+="$s`r`n#"}
$file = New-Item -type file "$name.ps1" -force

$template=@"
<#
 .NAME
 	$name.ps1
 .SYNOPSIS
 	$synopsis
 .DESCRIPTION
 	$description
 .SYNTAX
 	$syntax
 .EXAMPLES
 	$example1
	$example2
 .NOTES
 	AUTHOR:	$strName
  	EMAIL:	$email
	DATE:	$date
  	COMMENT: $comment
 .HELPURL
 	$helpurl1
	$helpurl2
 .SEEALSO
 	$seealso1
	$seealso2
	$seealso3
#>

#region-----royalty and version info-----
###########################################################################
#
# You have a royalty-free right to use, modify, reproduce, and
# distribute this script file in any way you find useful, provided that
# you agree that the creator, owner above has no warranty, obligations,
# or liability for such use.
#
# VERSION HISTORY:
# 1.0 $date - Initial release
#
###########################################################################
#endregion-----royalty and version info-----

#region-----code begins here-------

#todo---enter your code here

#endregion-----code begins here-------
"@ | out-file $file
ii $file
}
 
Set-Alias new New-ISEScript