Not sure why this worked; was just playing around
: ObjectClrOption ( 'useany', 'System.Management.Automation')
oM = ObjectClrNew('System.Management.Automation.PSObject')
Message("System.Management.Automation.PSObject")
but it raises intersting possibiities...
I get a 3074 error - "Expression continues past expected end."
Me too. Message only has one parameter.
Jim
Message("System.Management.Automation.PSObject",OM)
was having a bit of an issue just posting this... like a font fantasy...
Thought that is probably what you meant and had tried it. I do get an integer....which I assume is the reference for the object.
Jim
It is indeed an object reference integer. Since WIL is negatively typed, objects can be represented as a string of digits for display purposes.
Probably just another rabbit hole... and have regularly used System.Management.Automation to run Powershell script code from WB's CLR. I guess just looking if in WB you could assign a file, a process, or something else to a PSObject and work with it without need for external PS code... [json attached, just rename from .txt to .json]
json = Dirscript():"assets.json"
If ! FileExist(json) Then Terminate(@TRUE,"File Does Not Exist",json)
ObjectClrOption ( 'useany', 'System.Management.Automation')
oM = ObjectClrNew('System.Management.Automation.PSObject',json)
Message("System.Management.Automation.PSObject",OM)
Members = oM.Members
Props = oM.Properties
Methods = oM.Methods
Base = oM.BaseObject
Message("BaseObject",Base)
Message("Members",Members.ToString())
Message("Properties",Props.ToString())
Message("Methods",Methods.ToString())
oM=0
Exit
WinBatch doesn't implement any "special" features for any .Net class so what you see is what you get.
https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.psobject?view=powershellsdk-7.0.0 (https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.psobject?view=powershellsdk-7.0.0)
Quote from: td on December 31, 2021, 09:48:41 AM
WinBatch doesn't implement any "special" features for any .Net class so what you see is what you get.
rabbitHole = @TRUE