2013-07-30 62 views
1

我正在嘗試使用代碼located here,並對HTA進行了一些調整。它的工作原理到一個點:彈出窗口出現並關閉目標進程

Set wshShell = WScript.CreateObject("WScript.Shell") 

變爲:

Set wshShell = CreateObject("WScript.Shell") 

彈出來了,但直到我點擊它,它不會消失。我需要它在進程運行時出現,然後在結束時消失。爲什麼我的執行失敗呢?

ProgressMsg "Copying, Please wait.", "File Being Copied" 
strCMD = "cmd.exe /c robocopy " & strLocalSemesterCourse & " " & strServerSemesterCourse &" " & strFileName & " /LOG+:" & strLogName & " /V /FP /TEE" 
nReturn = objShell.Run(strCMD, 1, true) 
ProgressMsg "", "Finished" 

回答

0

您需要定義objProgressMsg全球變量對於這個工作:

Dim objProgressMsg 
... 
ProgressMsg "Copying, Please wait.", "File Being Copied" 
strCMD = "cmd.exe /c robocopy " & strLocalSemesterCourse & " " _ 
    & strServerSemesterCourse &" " & strFileName & " /LOG+:" & strLogName _ 
    & " /V /FP /TEE" 
nReturn = objShell.Run(strCMD, 1, true) 
ProgressMsg "", "Finished"

沒有全局變量,ProgressMsg()將使用本地變量objProgressMsg。局部變量在函數退出後不保留它們的值,所以每次調用函數時變量都將爲空。

+0

嗨 - 感謝您的幫助。我能夠得到它的幫助。 –