[Ttssh2-commit] [5219] Tera Term Menuのレジストリをiniファイル化するツール

svnno****@sourc***** svnno****@sourc*****
2013年 5月 1日 (水) 20:07:21 JST


Revision: 5219
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5219
Author:   yutakapon
Date:     2013-05-01 20:07:19 +0900 (Wed, 01 May 2013)
Log Message:
-----------
Tera Term Menuのレジストリをiniファイル化するツール

  - ActivePerlスクリプト

Added Paths:
-----------
    trunk/installer/ttpmenu/ttpmenu.pl

-------------- next part --------------
Added: trunk/installer/ttpmenu/ttpmenu.pl
===================================================================
--- trunk/installer/ttpmenu/ttpmenu.pl	                        (rev 0)
+++ trunk/installer/ttpmenu/ttpmenu.pl	2013-05-01 11:07:19 UTC (rev 5219)
@@ -0,0 +1,71 @@
+
+#
+# Export Tera Term Menu registry to ini file.
+#   with ActivePerl
+#
+# Usage:
+# c:\>perl ttpmenu.pl > ttpmenu.ini
+#
+
+use Win32::Registry;
+use strict;
+
+my $TTMREG = "Software\\ShinpeiTools\\TTermMenu";
+my $tips;
+my $key;
+my @subkeys;
+
+PrintSectionName("TTermMenu");
+ExportIniFile($TTMREG);
+
+$HKEY_CURRENT_USER->Open($TTMREG, $tips) or die "Can not open registry";
+$tips->GetKeys(\@subkeys);
+$tips->Close();
+foreach $key (@subkeys) {
+#	print "$key\n";
+	PrintSectionName("$key");
+	ExportIniFile($TTMREG . "\\" . $key);
+}
+
+
+exit(0);
+
+
+sub PrintSectionName {
+	my($name) = @_;
+	
+	print "[$name]\n";
+}
+
+
+sub ExportIniFile {
+	my($path) = @_;
+	my($tips);
+	my(%vals);
+	my($key, $RegType, $RegValue, $RegKey, @bytes);
+
+	$HKEY_CURRENT_USER->Open($path, $tips) or die "Can not open registry";
+
+	$tips->GetValues(\%vals);
+	foreach $key (keys(%vals)) {
+		$RegType     = $vals{$key}->[1];
+		$RegValue     = $vals{$key}->[2];
+		$RegKey     = $vals{$key}->[0];
+		print "$RegKey=";
+		if ($RegType == REG_DWORD) {
+			printf "%08x\n", $RegValue;
+			
+		} elsif ($RegType == REG_BINARY) {
+			@bytes = unpack('C*', $RegValue);
+			printf "%02x ", $_ foreach @bytes;
+			print "\n";
+		
+		} else {
+			print "$RegValue\n";
+		}
+	}
+	print "\n";
+
+	$tips->Close();
+}
+



Ttssh2-commit メーリングリストの案内