Product: PowerShell Studio 2021 (64 Bit)
Build: v5.8.183
OS: Windows 10 Pro (64 Bit)
Build: v10.0.19042.0
I have source that I packagae as both UI and commandline and have separate code for support of both. If I export to clipboard and save the content to a ps1 file (clipboard.ps1) then I would expect it to run up as a UI and behave the same as if I had run from PSS. When run from PSS (mainform.psf) , it works without any error. When run from the exported clipboard.ps1 it errors with the below error. I suspect that it is losing (or adding) something at the time of the export
At C:\cardinal\clipboard.ps1:881 char:16
+ Log "Complete"
+ ~
The string is missing the terminator: ".
At C:\cardinal\clipboard.ps1:875 char:41
+ ($Email -split ',') | ForEach-Object {
+ ~
Missing closing '}' in statement block or type definition.
At C:\cardinal\clipboard.ps1:870 char:3
+ {
+ ~
Missing closing '}' in statement block or type definition.
At C:\cardinal\clipboard.ps1:29 char:28
+ function Show-mainform_psf {
+ ~
Missing closing '}' in statement block or type definition.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : TerminatorExpectedAtEndOfString
Export to Clipboard causes errors
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Export to Clipboard causes errors
I also exported to a file and when I run this as a ps1 it works fine so the problem is definitely with export to clipboard. After performing a file compare between the export-to-file & export-to-clipboard, I can see that the Send-MailMessage has had some †inserts that it should not (-from email modified)
Send-MailMessage –From "xxxxx@jxxxxx.com" –To $To –Subject "$Subject" -Body "$Body" -SmtpServer $GLBVAR.smtp -port $GLBVAR.SmtpPort
Send-MailMessage –From "xxxxx@jxxxxx.com" –To $To –Subject "$Subject" -Body "$Body" -SmtpServer $GLBVAR.smtp -port $GLBVAR.SmtpPort
Send-MailMessage –From "xxxxx@jxxxxx.com" –To $To –Subject "$Subject" -Body "$Body" -SmtpServer $GLBVAR.smtp -port $GLBVAR.SmtpPort
Send-MailMessage –From "xxxxx@jxxxxx.com" –To $To –Subject "$Subject" -Body "$Body" -SmtpServer $GLBVAR.smtp -port $GLBVAR.SmtpPort
Send-MailMessage –From "xxxxx@jxxxxx.com" –To $To –Subject "$Subject" -Body "$Body" -SmtpServer $GLBVAR.smtp -port $GLBVAR.SmtpPort
Send-MailMessage –From "xxxxx@jxxxxx.com" –To $To –Subject "$Subject" -Body "$Body" -SmtpServer $GLBVAR.smtp -port $GLBVAR.SmtpPort
Re: Export to Clipboard causes errors
After some investigating, I noticed that your clipboard script file encoding is UTF-8. After changing this to UTF-8-BOM, clipboard.ps1 ran fine for me. Please try updating this from the status bar with this file open and let me know if it runs:
Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Export to Clipboard causes errors
I also was able to get the script to run after formatting script (Home->Edit):
Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Export to Clipboard causes errors
That's interesting. Changing the encoding did correct this but I have used "copy to clipboard" previously (perhaps not in this version of PSS) and have never had this issue? Thanks tho