外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
mshtaで線長を計算する(lnlength)
:mshtaで線長を計算する(lnlength)
@echo off
if exist jwc_temp.txt (
copy jwc_temp.txt myfiles > nul
mshta %~f0 < myfiles > jwc_temp.txt
)
goto:eof
REM #jww
REM #1ln 基準線を指示してください
REM #e
<script>
function hex(x) { return x < 10 ? x : x.toString(16) }
hs = []
lg = ""
l = 0
with (new ActiveXObject("Scripting.FileSystemObject")) {
f = GetStandardStream(0) //stdin
g = GetStandardStream(1) //stdout
with (Math) {
while (! f.AtEndOfStream) {
F = ($_ = f.ReadLine()).split(/\s+/)
if (/^hs/i .test($_)) { //hs スケール
for (i = 0; i <= 15; i++) hs[hex(i)] = F[i + 1] * 1.0;
}
if (/^lg[A-F0-9]/i .test($_)) { //lg レイヤグループ
plg = $_.substr(2, 1).toLowerCase(); if (lg == "") lg = plg;
}
if (/^\s+/i .test($_)) { //ln 指示線
p = hs[lg] / hs[plg]
lx = F[2] - F[0]
ly = F[3] - F[1]
l += sqrt(lx * lx + ly * ly) * p
}
}
f.close()
g.WriteLine("h#L = " + l.toFixed(3))
}
}
close()
</script>