viewpoint-particle

Author Topic: Systen Automation  (Read 330 times)

stanl

  • Pundit
  • *****
  • Posts: 1618
Systen Automation
« on: December 28, 2021, 08:31:00 am »

Not sure why this worked; was just playing around


:
Code: Winbatch
 ObjectClrOption ( 'useany', 'System.Management.Automation')
oM = ObjectClrNew('System.Management.Automation.PSObject')
Message("System.Management.Automation.PSObject")

 


but it raises intersting possibiities...

td

  • Tech Support
  • *****
  • Posts: 4044
    • WinBatch
Re: Systen Automation
« Reply #1 on: December 28, 2021, 08:40:30 am »
I get a 3074 error - "Expression continues past expected end."
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

  • Pundit
  • *****
  • Posts: 1792
    • Data & Stuff Inc.
Re: Systen Automation
« Reply #2 on: December 28, 2021, 09:01:18 am »
Me too.   Message only has one parameter.

Jim

stanl

  • Pundit
  • *****
  • Posts: 1618
Re: Systen Automation
« Reply #3 on: December 28, 2021, 10:13:25 am »
Message("System.Management.Automation.PSObject",OM)

was having a bit of an issue just posting this... like a font fantasy...

JTaylor

  • Pundit
  • *****
  • Posts: 1792
    • Data & Stuff Inc.
Re: Systen Automation
« Reply #4 on: December 28, 2021, 01:06:52 pm »
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

td

  • Tech Support
  • *****
  • Posts: 4044
    • WinBatch
Re: Systen Automation
« Reply #5 on: December 28, 2021, 03:07:57 pm »
It is indeed an object reference integer. Since WIL is negatively typed, objects can be represented as a string of digits for display purposes.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

stanl

  • Pundit
  • *****
  • Posts: 1618
Re: Systen Automation
« Reply #6 on: December 31, 2021, 05:54:34 am »
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]
Code: Winbatch

 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
 

td

  • Tech Support
  • *****
  • Posts: 4044
    • WinBatch
Re: Systen Automation
« Reply #7 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.

https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.psobject?view=powershellsdk-7.0.0
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

stanl

  • Pundit
  • *****
  • Posts: 1618
Re: Systen Automation
« Reply #8 on: January 01, 2022, 03:31:25 am »
WinBatch doesn't implement any "special" features for any .Net class so what you see is what you get.


rabbitHole = @TRUE