37 lines
1.2 KiB
PowerShell
37 lines
1.2 KiB
PowerShell
|
|
#Requires -RunAsAdministrator
|
||
|
|
$ErrorActionPreference = 'Continue'
|
||
|
|
$dte = New-Object -ComObject TcXaeShell.DTE.17.0
|
||
|
|
$dte.MainWindow.Visible = $true
|
||
|
|
try { $dte.SuppressUI = $false } catch {}
|
||
|
|
$dte.Solution.Open('C:\Users\tonycao\work\twincat3-auto-cli\TwinCAT_EL6695_Primary_2kHz\TwinCATProject1.sln')
|
||
|
|
Start-Sleep 25
|
||
|
|
$proj = $dte.Solution.Projects.Item(1)
|
||
|
|
Write-Host '--- project properties ---'
|
||
|
|
try {
|
||
|
|
$props = $proj.Properties
|
||
|
|
Write-Host "count: $($props.Count)"
|
||
|
|
for ($i = 1; $i -le $props.Count; $i++) {
|
||
|
|
$p = $props.Item($i)
|
||
|
|
Write-Host " $($p.Name) = $($p.Value)"
|
||
|
|
}
|
||
|
|
} catch { Write-Host "props err: $_" }
|
||
|
|
Write-Host '--- try sysmgr prefixes ---'
|
||
|
|
$sm = $null
|
||
|
|
for ($i = 0; $i -lt 20; $i++) {
|
||
|
|
try { $sm = $proj.Object; if ($sm) { break } } catch {}
|
||
|
|
Start-Sleep 3
|
||
|
|
}
|
||
|
|
if ($sm) {
|
||
|
|
foreach ($prefix in @('TISY','TISE','TISC','TISN','TISG','TIRL','TIRE','TIRR','TIS2','TIS3','TIMO','TICP','TIMA')) {
|
||
|
|
try {
|
||
|
|
$it = $sm.LookupTreeItem($prefix)
|
||
|
|
if ($it) { Write-Host "$prefix => $($it.Name) cc=$($it.ChildCount)" }
|
||
|
|
} catch {}
|
||
|
|
}
|
||
|
|
Write-Host '--- QueryTreeItems ---'
|
||
|
|
try {
|
||
|
|
$q = $sm.QueryTreeItems('')
|
||
|
|
Write-Host ($q | Out-String)
|
||
|
|
} catch { Write-Host "query err: $_" }
|
||
|
|
}
|