次のスニペットを実行して許容値を入力すると、目的の結果が得られます。
do while len(strselect) = 0 'or strselect<>"1" or strselect<>"2" or strselect<>"3"
strselect = inputbox ("Please select:" &vbcrlf&vbcrlf&_
"1. Add an entry" &vbcrlf&vbcrlf&_
"2. Remove an entry" &vbcrlf&vbcrlf&_
"3. Search for an entry" &vbcrlf, "Contact Book")
if isempty(strselect) then
wscript.quit()
elseif strselect="1" then
wscript.echo "You chose 1"
elseif strselect="2" then
wscript.echo "You chose 2"
elseif strselect="3" then
wscript.echo "You chose 3"
end if
loop
ただし、(条件にコメントを含めることによって) 検証プロセスをさらに制限しdo while
、スニペットを再度実行すると、対応するif
条件がトリガーされますが、do
ループは終了せずに継続します。
私はループ条件で使用してみましたが、isnumeric
喜びはありません...ループを終了するために何が欠けていますか?cstr
do
strselect