選択する漢字によっては、さらに架空度が増します。 結果をコマンドプロンプトへ出力する事を前提としているので、Wscript.exe でスクリプトが実行された場合、Crun という関数で コマンドプロンプトを開いて cscript.exe でスクリプトを強制的に再実行させるようにしています。
<JOB> <OBJECT id="WshShell" progid="WScript.Shell" /> <SCRIPT language="VBScript"> ' *********************************************************** ' 処理開始 ' *********************************************************** nMax = 20 ' 取得する人数 Crun ' 1、2 は教育漢字の最初 strName1 = "愛悪圧安暗案以位囲委意易異移胃衣遺医域育一印員因引飲院右宇羽" strName2 = "雨運雲営映栄永泳英衛液益駅円園延沿演遠塩央往応横王黄億屋恩温" strName3 = "男也一行樹之朗七人" strName4 = "子代美恵" For i = 1 to nMax ' 姓1文字目 nTarget = Random( 1, Len(strName1) ) strName = Mid( strName1, nTarget, 1 ) ' 1文字目と2文字目が一致したら除外 nTarget2 = nTarget Do while( nTarget = nTarget2 ) nTarget2 = Random( 1, Len(strName1) ) Loop ' 姓2文字目 strName = strName & Mid( strName1, nTarget2, 1 ) & " " ' 名1文字目 nTarget = Random( 1, Len(strName2) ) strName = strName & Mid( strName2, nTarget, 1 ) ' 性別 nTarget = Random( 0, 1 ) ' 性別によって名2文字目を決定 if nTarget = 0 then nTarget = Random( 1, Len(strName3) ) strName = strName & Mid( strName3, nTarget, 1 ) else nTarget = Random( 1, Len(strName4) ) strName = strName & Mid( strName4, nTarget, 1 ) end if Wscript.Echo strName Next ' *********************************************************** ' 範囲内ランダム値取得 ' *********************************************************** Function Random( nMin, nMax ) Randomize Random = nMin + Int(Rnd * (nMax - nMin + 1)) End function ' *********************************************************** ' Cscript.exe で強制実行 ' *********************************************************** Function Crun( ) Dim str str = WScript.FullName str = Right( str, 11 ) str = Ucase( str ) if str <> "CSCRIPT.EXE" then str = WScript.ScriptFullName strParam = " " For I = 0 to Wscript.Arguments.Count - 1 if instr(Wscript.Arguments(I), " ") < 1 then strParam = strParam & Wscript.Arguments(I) & " " else strParam = strParam & Dd(Wscript.Arguments(I)) & " " end if Next Call WshShell.Run( "cmd.exe /c cscript.exe " & Dd(str) & strParam & " & pause", 3 ) WScript.Quit end if End Function ' *********************************************************** ' ダブルクォート ' *********************************************************** Function Dd( strValue ) Dd = """" & strValue & """" End function </SCRIPT> </JOB>
💙 例えば...院引 演恵 域院 雲恵 衣位 応行 印意 央樹 羽因 往恵 院意 応行 位胃 沿子 囲移 塩子 異因 映代 以引 雨人 圧因 塩代 域右 温七 易育 延七 右委 黄子 異引 雲美 圧衣 園朗 愛員 王七 悪右 英之 圧遺 益樹 院暗 横美