More Interactive when writing Powershell Scripts
Forum rules
Do not post any licensing information in this forum.
Do not post any licensing information in this forum.
- jdelatorre@hfinc.com
- Posts: 54
- Last visit: Wed Jan 30, 2008 1:42 am
More Interactive when writing Powershell Scripts
I'm not sure if this is already on the "Wish List", but would be EXTREMELY helpful if PrimalScript was more Interactive while scripting, similar to Powershell + code Editor/Powershell Anaylzer.For example when in PS+ code editor when typing a Grouped Expression:(get-date). the members for that expression would come up. Not sure what it would take to get this done but would be VERY nice.
More Interactive when writing Powershell Scripts
So it would basically do something like this?Get-Date | gm -m method
- joel.delatorre
- Posts: 83
- Last visit: Tue Jan 17, 2017 9:26 am
More Interactive when writing Powershell Scripts
yes except it would better resemble "get-date | gm" so you can see all the methods AND properties
get-date | gm -m method would only return avail methods
get-date | gm -m method would only return avail methods
More Interactive when writing Powershell Scripts
Try using:get-date | gmThis should return back all the info. (GM is the alias to Get-Member). So in your previous request - I limited your request to just methods by doing the -membertype. You could also do the following to get just method & property:Get-Date | Get-Member -MemberType Method, PropertyYou can find more info in PowerShell about Get-Member by using:help gm -dHope this helps you out.b0n3z2008-03-21 16:05:01
- joel.delatorre
- Posts: 83
- Last visit: Tue Jan 17, 2017 9:26 am
More Interactive when writing Powershell Scripts
I think you missed the point. My request to Sapien is to add more interactivity to the IDE. that way you dont have to type in a console session "get-date | gm" to see the avail methods and properties. then go back to the IDE and type in wanted method/property. While IN the IDE typing the below expression or any grouped expression for that matter.
(get-date).
This would popup a intellisense menu that would show all available methods and properties for that given Grouped Expression. If you have PowerShell Plus installed try using the Editor and typing in the example im talking about to see what I mean.
(get-date).
This would popup a intellisense menu that would show all available methods and properties for that given Grouped Expression. If you have PowerShell Plus installed try using the Editor and typing in the example im talking about to see what I mean.
More Interactive when writing Powershell Scripts
The problem is that PrimalScript is a static environment. It can't execute each cmdlet to see what "comes back," and very few cmdlets actually return a fixed data type.
For example, if you run
(Gci)
What type would be displayed? A file? A folder? A registry key? An OU?
If you have Enterprise and have installed the .NET SDK, you can get code hinting and completion on types by statically typing them:
[date]$d = Get-Date
For example, if you run
(Gci)
What type would be displayed? A file? A folder? A registry key? An OU?
If you have Enterprise and have installed the .NET SDK, you can get code hinting and completion on types by statically typing them:
[date]$d = Get-Date
- joel.delatorre
- Posts: 83
- Last visit: Tue Jan 17, 2017 9:26 am
More Interactive when writing Powershell Scripts
So I guess there is no works in changing that.
To address what type would be returned would count on what Powershell returns. The only way to know for sure is Primalscript would have to execute the given expression in the background then capture that Type. But i also know that this presents a security risk so I understand why this hasnt been implemented.
To address what type would be returned would count on what Powershell returns. The only way to know for sure is Primalscript would have to execute the given expression in the background then capture that Type. But i also know that this presents a security risk so I understand why this hasnt been implemented.
More Interactive when writing Powershell Scripts
Pretty much exactly. It could also be a production risk - if you put
(Remove-Item C:*.* -recurse)
You wouldn't be very happy if it ran . The only other option would be for PrimalScript to maintain a static database, so that it could "know" what objects a command output - the problem with that, of course, is that we'd have to research EVERY command out there, not just those from Microsoft - we'd wind up being inconsistent and behind the times a lot, and nobody would thank us.
PowerShell v2 may be addressing this by providing more metadata with commands, so that an editor like PrimalScript could extract that metadata in advance and "know" more about the cmdlets. We'll see how that pans out as v2 shapes up.
(Remove-Item C:*.* -recurse)
You wouldn't be very happy if it ran . The only other option would be for PrimalScript to maintain a static database, so that it could "know" what objects a command output - the problem with that, of course, is that we'd have to research EVERY command out there, not just those from Microsoft - we'd wind up being inconsistent and behind the times a lot, and nobody would thank us.
PowerShell v2 may be addressing this by providing more metadata with commands, so that an editor like PrimalScript could extract that metadata in advance and "know" more about the cmdlets. We'll see how that pans out as v2 shapes up.
- joel.delatorre
- Posts: 83
- Last visit: Tue Jan 17, 2017 9:26 am