...
Windows Powershell is a new command line shell and task-based scripting technology which is designed to work directly with objects inside the Windows operating system. It is designed to work with both .NET language objects as well as COM Components with consistent syntax and naming conventions.Powershell's ability to work with objects makes it particularly well suited to interacting with the AWR Design Environment Component object model. More information about PowerShell can be obtained from the PowerShell Documentation and PowerShell Scripting pages on the Microsoft Web site.
Once you've downloaded and installed PowerShell you can get started right away working with the AWR Design Environment. To create and instance of AWR DE enter the following at the command line:
Code Snippets
PS C:\> $MWOffice = new-object -comobject "AWR.MWOffice" |
This line tells powershell to create a new object of type comobject with the Program ID (ProgID) of "AWR.MWOffice" which is the Program ID for the latest version of MWOffice installed on your system. If you have more than one version and would like create an instance of a particular version you can do so with the following commands.
...
PS C:\> $Element.Parameters | foreach-object { $_.Name + " = "+ $_.ValueAsString } ID = TL1 W = 2040 L = 200100 MSUB = |
This gives us a cleaner summary. Now lets set the width to 40:
PS C:\> $Element.Parameters.Item("W").ValueAsString = "4020" PS C:\> $Element.Parameters | foreach-object { $_.Name + " = "+ $_.ValueAsString } ID = TL1 W = 4020 L = 200100 MSUB = |
So in the first line we've set the parameter value as string to 40 and the second line lists the parameter names and values again to show the updated value.
...