#!c:\usr\pkgs\perl\bin\perl.exe print "FILENAME\tMODEL_NAME\tJAPANESE_FONT\tRESOLUTIONS\tPAPER_SIZES\tIS_COLOR\n"; foreach $file (@ARGV) { local ($printername); local (@resolutions) = (); local (@papersizes) = (); local ($is_japanese) = 'NONE'; local ($is_color) = 'NO'; local ($buf, @lines); print (STDERR '.'); open(FP, "< $file") || die; binmode FP; read(FP, $buf, (-s $file)); close FP; $buf =~ s/\r\n?/\n/g; @lines = split(/\n/, $buf); foreach (@lines) { next unless /^\*/; s/^\*//; s/\s*\n$//; # 機種名の記述 if (/^NickName: (.+)/) { $printername = $1; $printername =~ s/"//g; $printername =~ s/\s/_/g; } # 対応用紙サイズの記述 elsif (/^(Default)?PageSize:? +([^:\/]+)(\/[^:\/]+)?(:.*)$/) { $two = $2; push (@papersizes, $two) if !grep (/$two/, @papersizes); } # 対応解像度の記述 elsif (/^(Default)?Resolution:? +(\d+x)?(\d+)dpi/) { local ($res); if ($2 eq '' || $2==$3) {$res=$3;} else {$res="$2$3";} push (@resolutions, $res) if !grep (/$res/, @resolutions); } #90ms-RKSJ のフォントがあるか?(そういう機種は排除の必要あり) elsif (/^Font (Ryumin-Light|GothicBBB-Medium)-90ms-RKSJ-H/) {$is_japanese = '90ms_installed';} # リュウミンライト/中ゴシックBBB のどちらかがあるか elsif (/^Font (Ryumin-Light|GothicBBB-Medium)-RKSJ-H/ && $is_japanese ne '90ms_installed') {$is_japanese = 'Ryumin_without_90ms';} # 日本語フォントがある? elsif (/RKSJ/ && $is_japanese eq 'NONE') {$is_japanese = 'some';} elsif (/ColorDevice:\s+True/) {$is_color = 'YES';} } if ($] >= 5) {eval '@resolutions = sort {$a <=> $b} @resolutions;';} @papersizes = sort @papersizes; $printername = 'UNKNOWN' if $printername eq ''; print join("\t", $file, $printername, $is_japanese, join('/',@resolutions) . "dpi", join('/',@papersizes), $is_color ) . "\n"; }