外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
mahtaで円を描く
:mshtaで円を描く
@echo off
if exist jwc_temp.txt (
copy jwc_temp.txt myfiles > nul
mshta %~f0 > jwc_temp.txt
)
goto:eof
REM #jww
REM #1-%d 円の中心を指示してください
REM #2%d 円周上の点を指示してください
REM #e
<script>
with (new ActiveXObject("Scripting.FileSystemObject")) {
g = GetStandardStream(1)
f = OpenTextFile("myfiles")
while (! f.AtEndOfStream) {
$F = ($_ = f.ReadLine()).split(/\s+/)
if (/^hp1-/i .test($_)) { p1 = $F.slice(1, 3) }
if (/^hp2 /i .test($_)) { p2 = $F.slice(1, 3)
with( Math ){
x1 = p1[0] * 1.0; y1 = p1[1] * 1.0
x2 = p2[0] * 1.0; y2 = p2[1] * 1.0
x = x2 - x1
y = y2 - y1
r = sqrt(x * x + y * y)
}
g.WriteLine( ["ci", x1, y1, r].join(" ") )
}
}
f.Close()
}
close()
</script>
mahta.exe は wscript.exe で代用できるようです。
@if(0==1) //円を描く
@echo off
wscript //nologo //e:jscript %~f0
goto:eof
REM #jww
REM #1-%d 円の中心を指示してください
REM #2%d 円周上の点を指示してください
REM #e
@else
with( new ActiveXObject("Scripting.FileSystemObject") ){
if( FileExists("jwc_temp.txt") ){
f = OpenTextFile("jwc_temp.txt")
while( ! f.AtEndOfStream ){
$F = (line = f.ReadLine()).split(/\s+/)
if( /^hp1-/i .test(line) ){ p1 = [$F[1], $F[2]] }
if( /^hp2 /i .test(line) ){ p2 = $F.slice(1, 3) }
}
f.close()
with( Math ){
x1 = p1[0] * 1.0; y1 = p1[1] * 1.0
x2 = p2[0] * 1.0; y2 = p2[1] * 1.0
x = x2 - x1
y = y2 - y1
r = sqrt(x * x + y * y)
}
g = CreateTextFile("jwc_temp.txt")
g.WriteLine( ["ci", x1, y1, r].join(" ") )
g.close()
}
}
@end