svnno****@sourc*****
svnno****@sourc*****
2013年 4月 30日 (火) 23:35:51 JST
Revision: 5217 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5217 Author: yutakapon Date: 2013-04-30 23:35:50 +0900 (Tue, 30 Apr 2013) Log Message: ----------- Tera Term Menuのレジストリをiniファイル化するツール - PowerShellスクリプト #そのうち、Perlスクリプト版も作ってみる予定。 ##下記ブログでは、UNIXシェルスクリプト版。 http://dice-k-0.blogspot.jp/2012/08/teraterm-menu.html Added Paths: ----------- trunk/installer/ttpmenu/ trunk/installer/ttpmenu/ttpmenu.ps1 -------------- next part -------------- Added: trunk/installer/ttpmenu/ttpmenu.ps1 =================================================================== --- trunk/installer/ttpmenu/ttpmenu.ps1 (rev 0) +++ trunk/installer/ttpmenu/ttpmenu.ps1 2013-04-30 14:35:50 UTC (rev 5217) @@ -0,0 +1,96 @@ + +# +# Export Tera Term Menu registry to ini file. +# with PowerShell +# +# Usage: +# PS>.\ttpmenu.ps1 > ttpmenu.ini +# + +$TTMREG = "HKCU:\Software\ShinpeiTools\TTermMenu" +$TTMFILE = "ttpmenu.ini" + + + +Function PrintEntry +{ + Param($obj) + + begin { +# %{"{0}={1,8:x8}" -f $prop, $val} + } + + process { + $type = $obj.value.GetType().name; +# Write-Host "$type" + if ($type -eq "Int32" -or $type -eq "UInt32") { + Write-Output ("{0}={1:x8}" -f $obj.property, $obj.value) + } elseif ($type -eq "Byte[]") { + Write-Output ("{0}={1}" -f $obj.property, [BitConverter]::ToString($obj.value).Replace("-", " ")) + } else { + Write-Output ("{0}={1}" -f $obj.property, $obj.value) + } + } + + end { + } +} + + +Function ExportIniFile +{ + Param( + [Parameter(Mandatory=$true)] + [string]$path) + + Push-Location + Set-Location $path + + $s = Get-ItemProperty $path + Write-Output ("[{0}]" -f $s.PSChildName); + + $hash = @{}; + $obj; + + Get-Item . | + Select-Object -ExpandProperty property | + ForEach-Object { + New-Object psobject -Property @{ + "property"=$_; + "value" = (Get-ItemProperty -Path . -Name $_).$_ + } + } | + ForEach-Object { + PrintEntry($_) + } +# %{"{0}={1,8:x8}" -f $_.property, $_.value} +# Format-Table property, value -AutoSize + Pop-Location + + Write-Output ""; +} + + +Function Main +{ + # \x8Dŏ\x89\x82̐ݒ\xE8\x8F\xEE\x95\xF1\x82\xF0\x8Fo\x97͂\xB7\x82\xE9 + ExportIniFile($TTMREG); + + + # \x8Ae\x83z\x83X\x83g\x82̐ݒ\xE8\x82\xF0\x8Fo\x97͂\xB7\x82\xE9 + Push-Location + $rootitem = Get-ItemProperty $TTMREG + Set-Location $rootitem.PSPath; + $items = Get-ChildItem . | ForEach-Object {Get-ItemProperty $_.PSPath}; + ForEach ($item in $items) + { + # Write-Host ("{0}" -f $item.PSPath); + ExportIniFile($item.PSPath); + } + Pop-Location +} + + +Main + +