More Interactive when writing Powershell Scripts

Post feature requests, product enhancement ideas, and other product-specific suggestions here. Do not post bug reports.
Forum rules
Do not post any licensing information in this forum.
This topic is 16 years and 4 days old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
jdelatorre@hfinc.com
Posts: 54
Last visit: Wed Jan 30, 2008 1:42 am

More Interactive when writing Powershell Scripts

Post by jdelatorre@hfinc.com »

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.
User avatar
b0n3z
Posts: 10
Last visit: Tue Jan 27, 2015 7:26 pm

More Interactive when writing Powershell Scripts

Post by b0n3z »

So it would basically do something like this?Get-Date | gm -m method
User avatar
joel.delatorre
Posts: 83
Last visit: Tue Jan 17, 2017 9:26 am

More Interactive when writing Powershell Scripts

Post by joel.delatorre »

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
User avatar
b0n3z
Posts: 10
Last visit: Tue Jan 27, 2015 7:26 pm

More Interactive when writing Powershell Scripts

Post by b0n3z »

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
User avatar
joel.delatorre
Posts: 83
Last visit: Tue Jan 17, 2017 9:26 am

More Interactive when writing Powershell Scripts

Post by joel.delatorre »

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.
User avatar
donj
Posts: 416
Last visit: Thu May 29, 2008 5:08 am

More Interactive when writing Powershell Scripts

Post by donj »

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
User avatar
joel.delatorre
Posts: 83
Last visit: Tue Jan 17, 2017 9:26 am

More Interactive when writing Powershell Scripts

Post by joel.delatorre »

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.
User avatar
donj
Posts: 416
Last visit: Thu May 29, 2008 5:08 am

More Interactive when writing Powershell Scripts

Post by donj »

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.
User avatar
joel.delatorre
Posts: 83
Last visit: Tue Jan 17, 2017 9:26 am

More Interactive when writing Powershell Scripts

Post by joel.delatorre »

Good to know. Thanks for your quick response Don.
This topic is 16 years and 4 days old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked