>>406
一応できたので貼っておきます。
# -*- coding: Windows-31j -*-
in_folder = "C:\\馬印\\in\\"
temp_folder = "C:\\馬印\\temp\\"
out_file = "C:\\馬印\\out\\馬印.csv"
arry_raceid = Array.new
arry_raceid = ["08","09","07","10","05","06","03","04","01","02"] #場所コード変換(KOL→JRA−VAN)
outfile = open(out_file,"w")
Dir::foreach(in_folder){|infile|
next if /^kd3_hb[0-9][0-9][0-9][0-9][0-9][0-9]\.lzh$/ !~ infile
cmd1 = "del /q " + temp_folder + "*.*"
cmd2 = "lhact x " + in_folder + infile + " " + temp_folder
system(cmd1)
system(cmd2)
open(temp_folder + "kol_den2.kd3","r"){|file|
while line = file.gets
record = line.force_encoding('ASCII-8BIT')
raceid = record[12,8] + arry_raceid[record[0,2].to_i] + record[6,6] + record[23,2]
s1 = record[254,1] #予想印1
case s1
when "0" then y1 = "◎".force_encoding('ASCII-8BIT')
when "1" then y1 = "◯".force_encoding('ASCII-8BIT')
when "2" then y1 = "▲".force_encoding('ASCII-8BIT')
when "3" then y1 = "△".force_encoding('ASCII-8BIT')
when "4" then y1 = "×".force_encoding('ASCII-8BIT')
else y1 = ""
end
if y1 != "" then
rec = "RX" + raceid + "," + y1
outfile.puts(rec)
end
end
}
}
outfile.close