CPolydorou.PSISE module updates
The latest release of my Powershell module for PowerShell ISE host contains a new function named "Insert-PSISEQuotes" that updates the text in the current open file.
There are many times when I have been given a list of items by email, or I have copied them from another file or event written them line by line. In order to transfer these items to a variable, I usually copy the text in a new text file and then use the Get-Content cmdlet to get the contents of the file and store them in a variable for later use.
The "Insert-PSISEQuotes" function will insert double quotes in the start and end of each line in the current file open in ISE followed by a comma and the end of the line. I can also add a variable assignment or just parentheses to make the text an array.
Let's take a list of email addresses for example:
You can convert the list to an array using the "Array" parameter:
The "Variable" parameter will convert the text to an array too but it will also assign the array to a variable:
There is also the option to trim the start and end of each line in order to remove any spaces that may have been copied by mistake.
After the command is executed, the cursor is placed at the end of the current file in order for the user to continue with the script.
I hope you'll find this function useful!
There are many times when I have been given a list of items by email, or I have copied them from another file or event written them line by line. In order to transfer these items to a variable, I usually copy the text in a new text file and then use the Get-Content cmdlet to get the contents of the file and store them in a variable for later use.
The "Insert-PSISEQuotes" function will insert double quotes in the start and end of each line in the current file open in ISE followed by a comma and the end of the line. I can also add a variable assignment or just parentheses to make the text an array.
Let's take a list of email addresses for example:
You can convert the list to an array using the "Array" parameter:
The "Variable" parameter will convert the text to an array too but it will also assign the array to a variable:
There is also the option to trim the start and end of each line in order to remove any spaces that may have been copied by mistake.
After the command is executed, the cursor is placed at the end of the current file in order for the user to continue with the script.
I hope you'll find this function useful!