0
我有一個HTA,作爲創建一個USB實用程序磁盤的一部分,將一組文件複製到USB棒。它工作正常,但問題是在複製過程正在運行時,HTA變得無響應。vbscript hta freeze當複製文件
Const FOF_CREATEPROGRESSDLG = &H0&
sub CopyFiles(driveletter) ' Copys Files to the new USB Disk showing progress bar
if radio(0).checked Then
Set objFilesys = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
driveletter = ((driveletter) & "\")
Set objFolder = objshell.NameSpace(driveletter)
pathstring = objFilesys.GetAbsolutePathName("c:")
objFolder.CopyHere pathstring & "\" & "*.*", FOF_CREATEPROGRESSDLG
exit sub
elseif radio(1).checked Then
Set objFilesys = CreateObject("Scripting.FileSystemObject")
set objShell = CreateObject("shell.application")
pathstring = userselections.txtFile.value
if objFilesys.fileExists(pathstring & "\" & "kernel.sys") then
driveletter = ((driveletter) & "\")
Set objFolder = objshell.NameSpace(driveletter)
objFolder.CopyHere pathstring & "\" & "*.*", FOF_CREATEPROGRESSDLG
Else
msgbox "Error! The Specified path does not contain valid Install Files", vbcritical
end if
end if
end sub
對於每個運行的命令,HTA都會「凍結」。對於大多數不重要的命令構建而言,如複製文件或解析文檔等,通常需要更長時間,然後您會注意到凍結。 如上所述,您可以在複製過程中添加一些暫停以使hta更具響應性。也許這可以給你一些額外的信息:http://www.visualbasicscript.com/Avoid-HTA-interface-freeze-during-long-process-m82946.aspx – Mathias