Page 1 of 2

Powershell Studio 2019 not parsing the script blocks

Posted: Thu Jul 25, 2019 12:08 am
by Binu.Bk
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

Re: Powershell Studio 2019 not parsing the script blocks

Posted: Thu Jul 25, 2019 12:17 am
by Alexander Riedel
*** 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.

Re: Powershell Studio 2019 not parsing the script blocks

Posted: Thu Jul 25, 2019 4:17 am
by Binu.Bk
Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.166
OS: Windows 10 Pro (64 Bit)
Build: v10.0.17763.0

Re: Powershell Studio 2019 not parsing the script blocks

Posted: Thu Jul 25, 2019 4:27 am
by Binu.Bk
pstudio.png
pstudio.png (53.55 KiB) Viewed 15349 times
microsoftpowershellise.png
microsoftpowershellise.png (85.31 KiB) Viewed 15349 times
see the difference in grouping, point 3 in pstudio shows its parsing the items after "@ as string. in ms ise, its parsed properly

Re: Powershell Studio 2019 not parsing the script blocks

Posted: Thu Jul 25, 2019 7:10 am
by brittneyr
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 15343 times
Could you please upload the your script here:
https://www.sapien.com/support/upload

Re: Powershell Studio 2019 not parsing the script blocks

Posted: Thu Jul 25, 2019 4:03 pm
by Binu.Bk
Hello Brittney

The file is now uploaded

Regards
Binu B K

Re: Powershell Studio 2019 not parsing the script blocks

Posted: Sun Jul 28, 2019 11:59 pm
by Binu.Bk
Are you able to reproduce the issue ?

Re: Powershell Studio 2019 not parsing the script blocks

Posted: Mon Jul 29, 2019 6:52 am
by brittneyr
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 15100 times

Re: Powershell Studio 2019 not parsing the script blocks

Posted: Mon Jul 29, 2019 9:38 pm
by Binu.Bk
Hello Brittney

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

Regard
Binu B K

Re: Powershell Studio 2019 not parsing the script blocks

Posted: Wed Aug 07, 2019 7:40 am
by brittneyr
This issue has been resolved and will be in the next service release.