@REM 単位毎の範囲内合計
@echo off
REM #jww
REM #cd
REM #h3
REM #0合計値記入位置を指示してください free(L) Read(R)
REM #c行間(図寸) 無指定:5mm/_/a
REM #bz
REM #e
copy jwc_temp.txt temp.txt > nul
ruby -x %~f0 temp.txt %1 > jwc_temp.txt
pause
exit
#!ruby -Ks
gyo=5.0
while ARGV.size>1
case argument=ARGV.pop
when /\/a/
gyo=argument[2..-1].to_f
end
end
suti_a=[]
while ARGF.gets
xy=split
if xy[0]=~/^c[hsvroptkz2]/
moji=$'.chomp if $_ =~ /\"/
if moji =~ /(-*\d+,*\d*\.*\d*)([^\d]*)/
suti_a<<[($1.delete(",")).to_f,$2.chomp]
end
end
end
puts "bz"
sum=0;tani="";y=0.0
while youso=suti_a.shift
sum,tani=youso[0],youso[1]
if suti_a.size>0
a=suti_a.select{|item| tani == item[1]}
if a && a.size>0
suti_a -= a
a.each{|item|sum += item[0]}
end
end
printf("ch 0 #{y} 1 0\"%s%s\n",sum,tani)
y -= gyo
end
@REM 単位毎の範囲内合計
@echo off
REM #jww
REM #cd
REM #h3
REM #0合計値記入位置を指示してください free(L) Read(R)
REM #c行間(図寸) 無指定:5mm/_/a
REM #bz
REM #e
copy jwc_temp.txt temp.txt > nul
ruby -x %~f0 temp.txt %1 > jwc_temp.txt
pause
exit
#!ruby -Ks
hash={"ー"=>"-","−"=>"-","0"=>"0","1"=>"1","2"=>"2","3"=>"3","4"=>"4","5"=>"5","6"=>"6","7"=>"7","8"=>"8","9"=>"9",","=>",","."=>"."}
gyo=5.0
while ARGV.size>1
case argument=ARGV.pop
when /\/a/
gyo=argument[2..-1].to_f
end
end
suti_a={}
while ARGF.gets
xy=split
if xy[0]=~/^c[hsvroptkz2]/
moji=$'.chomp if $_ =~ /\"/
tango=moji.split('')
tango.collect!{|item|hash.key?(item) ? hash[item] : item}
moji=tango.join
if moji =~ /(-*\d+,*\d*\.*\d*)([^\d]*)/
tani=$2.chomp
sum=($1.delete(",")).to_f
suti_a.key?(tani) ? suti_a[tani] += sum : suti_a[tani] = sum
end
end
end
puts "bz"
y=0.0
suti_a.each{|key,value|
printf("ch 0 #{y} 1 0\"%s%s\n",value,key)
y -= gyo
}
@REM 単位毎の範囲内合計
@echo off
REM #jww
REM #cd
REM #h3
REM #0合計値記入位置を指示してください free(L) Read(R)
REM #c行間(図寸) 無指定:5mm/_/a
REM #bz
REM #e
copy jwc_temp.txt temp.txt > nul
ruby -x %~f0 temp.txt %1 > jwc_temp.txt
pause
exit
#!ruby -Ks
require 'jcode'
gyo=5.0
while ARGV.size>1
case argument=ARGV.pop
when /\/a/
gyo=argument[2..-1].to_f
end
end
suti_a={}
while ARGF.gets
xy=split
if xy[0]=~/^c[hsvroptkz2]/
moji=$'.chomp if $_ =~ /\"/
moji.tr!('0-9−.,/ー','0-9\-.,/\-')
if moji =~ /(-*\d+,*\d*\.*\d*)([^\d]*)/
tani=$2.chomp
sum=($1.delete(",")).to_f
suti_a.key?(tani) ? suti_a[tani] += sum : suti_a[tani] = sum
end
end
end
puts "bz"
y=0.0
suti_a.each{|key,value|
printf("ch 0 #{y} 1 0\"%s%s\n",value,key)
y -= gyo
}
@REM 単位毎の範囲内合計
@echo off
REM #jww
REM #cd
REM #h3
REM #0合計値記入位置を指示してください free(L) Read(R)
REM #c行間(図寸) 無指定:5mm/_/a
REM #bz
REM #e
copy jwc_temp.txt temp.txt > nul
ruby -x %~f0 temp.txt %1 > jwc_temp.txt
pause
exit
#!ruby -Ks
require 'jcode'
include Math
hash={"π"=>"PI","^u"=>"**","^"=>"**"}
array=["√","q","Q"]
gyo=5.0
while ARGV.size>1
case argument=ARGV.pop
when /\/a/
gyo=argument[2..-1].to_f
end
end
suti_a={}
while ARGF.gets
xy=split
if xy[0]=~/^c[hsvroptkz2]/
moji=$'.chomp if $_ =~ /\"/
moji.tr!('A-Za-z0-9−.,/ー÷×*+()','A-Za-z0-9\-.,/\-/**+\(\)')
hash.each{|key,value|moji.gsub!(key,value)}
tango=moji.split('')
tango.collect!{|item|array.include?(item) ? "sqrt" : item}
moji=tango.join
if moji =~ /[^\d\(\)]*$/
tani=$&
suti=$`.delete(",")
else
tani=""
suti=moji
end
sum=eval(suti)
suti_a.key?(tani) ? suti_a[tani] += sum : suti_a[tani] = sum
end
end
puts "bz"
y=0.0
suti_a.each{|key,value|
printf("ch 0 #{y} 1 0\"%s%s\n",value,key)
y -= gyo
}