IsNumeric 函数根据用户的操作返回不同的值。如果用户在空白字段中按 OK,我的代码将正常工作。但是当用户按下取消我的代码退出循环。为什么?我需要那个 InputBox 对话框仍然无限出现,直到用户输入数字。这个怎么做?
<package>
<job id="NonDisabledServicesCollecting">
<COMMENT>
************************************************************
1 comment
2
3
************************************************************
</COMMENT>
<script language="VBScript">
flash_folder="I:\123\"
str_flash_folder_colFiles = ""
num_flash_folder_colFiles = 0
Set flash_folder_colFiles = CreateObject("Scripting.FileSystemObject").GetFolder(flash_folder).Files
Dim table_flash_folder_colFiles()
ReDim Preserve table_flash_folder_colFiles(flash_folder_colFiles.Count) 'zero-element not used
For Each flash_folder_objFile in flash_folder_colFiles
num_flash_folder_colFiles = num_flash_folder_colFiles + 1
table_flash_folder_colFiles(num_flash_folder_colFiles) = flash_folder_objFile.Name
str_flash_folder_colFiles = str_flash_folder_colFiles + cstr(num_flash_folder_colFiles) + " " + flash_folder_objFile.Name + vbCrLf
Next
Dim response
Do
response = InputBox("Please enter the number that corresponds to your selection:" + vbCrLf + str_flash_folder_colFiles, "Choose DLL to copy...")
If response = "" Then WScript.Echo "Input is empty." 'Detect Cancel
WScript.Echo response
WScript.Echo IsNumeric(response)
If IsNumeric(response) Then Exit Do 'Detect value response.
WScript.Echo "You must enter a numeric value."
Loop
selected_flush_DLL= flash_folder + table_flash_folder_colFiles(cint(response))
WScript.Echo selected_flush_DLL
</script>
</job>
</package>