外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
vbscriptで指示点を確認する(hp)
:vbscriptで指示点を確認する(hp)
@echo off
if not exist %~dp0eval.vbs echo ExecuteGlobal WScript.StdIn.ReadAll > %~dp0eval.vbs
for /f "delims=:" %%n in ('findstr /n "^#!" %0') do (
copy jwc_temp.txt myfiles > nul
(
: echo Option Explicit
echo On Error Resume Next
: echo On Error GoTo 0
more +%%n %0
) | cscript //nologo %~dp0eval.vbs > jwc_temp.txt
)
goto:eof
REM #jww
REM #1-%d 点を指示してください
REM #99#
REM #zs
REM #e
#!この次の行からプログラムを書いてください
'1)正規表現
Dim re
Set re = New RegExp
re.IgnoreCase = True '大文字と小文字を区別しない
re.Global = True '文字列全体を検索する
function reSplit(str)
re.Pattern = "[ ]+"
reSplit = Split(Trim(re.Replace(str," ")))
end function
function reTest(pat, str)
re.Pattern = pat
reTest = re.Test(str)
end function
'4)ユーザ定義関数
function dec(x)
if x = "a" then x = 10
if x = "b" then x = 11
if x = "c" then x = 12
if x = "d" then x = 13
if x = "e" then x = 14
if x = "f" then x = 15
dec = x
end function
Dim line, F
Dim i, hs(15), plg, lg
lg = ""
Dim hzs
Dim hp(100), hpn
With CreateObject("Scripting.FileSystemObject")
With .OpenTextFile("myfiles")
Do While Not .AtEndOfStream
line = .ReadLine: F = reSplit(line)
if reTest("^hs",line) then 'hs スケール
for i = 1 to 16
hs(i-1) = F(i)
next
end if
if reTest("^lg[A-F0-9]",line) then 'lg レイヤグループ
plg = LCase(Mid(line,3,1)): if lg = "" then lg = plg
end if
if reTest("^hzs",line) then hzs = Array(F(1),F(2)) '用紙サイズ
if reTest("^hp([1-9][0-9]?)-?",line) then '指示点の座標値
hp(re.Replace(F(0),"$1")*1) = Array(F(1), F(2))
hpn = hpn +1
end if
Loop
End With
End With
'外部変形
Dim w, h
w = hzs(0) * hs(dec(lg))
h = hzs(1) * hs(dec(lg))
WScript.Echo Join(Array(-w / 2.0, 0, w / 2.0, 0)) 'X軸
WScript.Echo Join(Array(0, -h / 2.0, 0, h / 2.0)) 'Y軸
WScript.Echo "ch 0 0 1 0 " & Chr(34) & "[0, 0]" '原点
for i = 1 to hpn '指示点の座標値
WScript.Echo "pt " & Join(hp(i))
WScript.Echo "ch " & Join(hp(i)) & " 1 0 " & Chr(34) & "[" & Join(hp(i),", ") & "]"
next