jw_cad 外部変形 - (1395) vbscriptで文字を逆書きする -

外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。

 

vbscriptで文字を逆書きする

:vbscriptで文字を逆書きする
@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 #h3 範囲内の「文字」データのみを選択
REM #g1
REM #e

#!この次の行からプログラムを書いてください
'1)正規表現
Dim re
Set re = New RegExp
re.IgnoreCase = True '大文字と小文字を区別しない
re.Global = True '文字列全体を検索する

function reTest(pat, str)
  re.Pattern = pat
  reTest = re.Test(str)
end function

Dim line
Dim i, str
With CreateObject("Scripting.FileSystemObject")
  With .OpenTextFile("myfiles")
  Do While Not .AtEndOfStream
    line = RTrim(.ReadLine)
    if reTest("^c[hvsroptkz2]", line) then
      i = InStr(line, Chr(34)) + 1
      str = StrReverse(Mid(line, i))
      WScript.Echo Mid(line, 1, i - 1) & str
    else
      if reTest("^hq",line) then WScript.Echo "hd" else WScript.Echo line
    end if
  Loop
  End With
End With