Powershell Studio 2019 not parsing the script blocks

Use this forum to ask questions before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE 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.
Binu.Bk
Posts: 6
Joined: Wed Jul 24, 2019 11:55 pm

Powershell Studio 2019 not parsing the script blocks

Post by Binu.Bk » Thu Jul 25, 2019 12:08 am

To help you better we need some information from you.

*** Please fill in the fields below if you are currently using a Trial Version of the Product. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build:
32 or 64 bit version of product:64 bit
Operating system: 64 bit
32 or 64 bit OS:

*** Please add details and screenshots as needed below. ***
Powershell studio is not detecting and parsing the script block properly @" "@

see sample code below

$remoteCommand1 =@"
function Get-Todaysfile
{
[CmdletBinding()]
Param (

[Parameter(Position = 0, Mandatory = $true)]
[string]$FolderToTrack,
[Parameter(Position = 1, Mandatory = $true)]
[string]$FileExtensionToTrack,
[Parameter(Position = 2, Mandatory = $true)]
[string]$logfile
)
Process
{
$TodaysDate = Get-Date
$TodaysDate = $TodaysDate.AddSeconds(-$TodaysDate.second)
$TodaysDate = $TodaysDate.AddMinutes(-$TodaysDate.Minute)
$TodaysDate = $TodaysDate.AddHours(-$TodayDate.Hour)
$TomorrowsDate = $TodaysDate.AddDays(+ 1)
if ($FolderToTrack -notmatch '\\$') { $FolderToTrack += '\' }
try
{
$TodaysFile = Get-ChildItem -Path $($FolderToTrack + "*") -Include $FileExtensionToTrack | Where-Object { ($_.LastWriteTime -ge $TodaysDate) -and ($_.LastWriteTime -lt $TomorrowsDate) }

}
catch
{

Write-log -LogString "Function:Get-Todaysfile ==> Error finding todays file." -logfile $logfile
}

}
}
"@



function Find-STRinFile
{
[CmdletBinding()]
Param (

[Parameter(Position = 0, Mandatory = $true)]
[string]$FileName,
[Parameter(Position = 1, Mandatory = $true)]
[string]$StringToFind,
[Parameter(Position = 2, Mandatory = $true)]
[string]$logfile
)
Process
{
$foundmystring = $false
try
{
if (Select-String -Pattern $StringToFind -Path $FileName -Quiet)
{
$foundmystring = $true
# do some action

}

}
catch
{
Write-log -LogString "Function:Find-STRinFile ==> Error searching through the file $FileName file." -logfile $logfile
}
retrun $foundmystring

}
}
DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

User avatar
Alexander Riedel
Posts: 7001
Joined: Tue May 29, 2007 4:43 pm

Re: Powershell Studio 2019 not parsing the script blocks

Post by Alexander Riedel » Thu Jul 25, 2019 12:17 am

*** Please fill in the fields below if you are currently using a Trial Version of the Product. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build:
32 or 64 bit version of product:64 bit
Operating system: 64 bit
32 or 64 bit OS:

Also, please elaborate on what "not parsing properly" means. Please keep in mind that we cannot see your screen.
Alexander Riedel
SAPIEN Technologies, Inc.

Binu.Bk
Posts: 6
Joined: Wed Jul 24, 2019 11:55 pm

Re: Powershell Studio 2019 not parsing the script blocks

Post by Binu.Bk » Thu Jul 25, 2019 4:17 am

Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.166
OS: Windows 10 Pro (64 Bit)
Build: v10.0.17763.0

Binu.Bk
Posts: 6
Joined: Wed Jul 24, 2019 11:55 pm

Re: Powershell Studio 2019 not parsing the script blocks

Post by Binu.Bk » Thu Jul 25, 2019 4:27 am

pstudio.png
pstudio.png (53.55 KiB) Viewed 1612 times
microsoftpowershellise.png
microsoftpowershellise.png (85.31 KiB) Viewed 1612 times
see the difference in grouping, point 3 in pstudio shows its parsing the items after "@ as string. in ms ise, its parsed properly

User avatar
brittneyr
Site Admin
Posts: 124
Joined: Thu Jun 01, 2017 7:20 am

Re: Powershell Studio 2019 not parsing the script blocks

Post by brittneyr » Thu Jul 25, 2019 7:10 am

So far I haven't been able to reproduce the parsing issue you are having.
script-coloring.png
script-coloring.png (101.28 KiB) Viewed 1606 times
Could you please upload the your script here:
https://www.sapien.com/support/upload
Brittney Ryn
SAPIEN Technologies, Inc.

Binu.Bk
Posts: 6
Joined: Wed Jul 24, 2019 11:55 pm

Re: Powershell Studio 2019 not parsing the script blocks

Post by Binu.Bk » Thu Jul 25, 2019 4:03 pm

Hello Brittney

The file is now uploaded

Regards
Binu B K

Binu.Bk
Posts: 6
Joined: Wed Jul 24, 2019 11:55 pm

Re: Powershell Studio 2019 not parsing the script blocks

Post by Binu.Bk » Sun Jul 28, 2019 11:59 pm

Are you able to reproduce the issue ?

User avatar
brittneyr
Site Admin
Posts: 124
Joined: Thu Jun 01, 2017 7:20 am

Re: Powershell Studio 2019 not parsing the script blocks

Post by brittneyr » Mon Jul 29, 2019 6:52 am

I have been able to reproduce your issue and have filed an internal bug report.

Thank you for bringing this to our attention. When I have some news to share, I'll be sure to post it here.

As for a temporary solution, the issue was fixed when using Format Script:
SPS_formatScript.png
SPS_formatScript.png (58.18 KiB) Viewed 1363 times
Brittney Ryn
SAPIEN Technologies, Inc.

Binu.Bk
Posts: 6
Joined: Wed Jul 24, 2019 11:55 pm

Re: Powershell Studio 2019 not parsing the script blocks

Post by Binu.Bk » Mon Jul 29, 2019 9:38 pm

Hello Brittney

Thanks for the update... i will put a tail on this thread.

Regard
Binu B K

User avatar
brittneyr
Site Admin
Posts: 124
Joined: Thu Jun 01, 2017 7:20 am

Re: Powershell Studio 2019 not parsing the script blocks

Post by brittneyr » Wed Aug 07, 2019 7:40 am

This issue has been resolved and will be in the next service release.
Brittney Ryn
SAPIEN Technologies, Inc.