2012-11-05 31 views
4

作爲我項目的一部分,我必須自動運行通過安全套接字層運行的Web應用程序。所以我必須清除SSL狀態,緩存,使用vbscript瀏覽歷史記錄,註銷後,如果某個帳戶無法正常工作。到目前爲止,我已經編寫了以下代碼,但它無法正常工作。使用vbscript清除SSL狀態

ieObj.document.execCommand ("ClearAuthenticationCache") 

Set objFSO = CreateObject("Scripting.FileSystemObject") 
Set objShell = CreateObject("Shell.Application") 
Set objFolder = objShell.Namespace(TEMPORARY_INTERNET_FILES) 
objFSO.DeleteFile (objFolder.Self.Path & "\*.*") 
ieObj.Quit 
Set ieObj = Nothing 
Application.Wait DateAdd("s", 2, Now) 

剛剛更新,現在我使用的SendKeys清除SSL狀態,

Sub ClearSSLState() 
' Macro1 Macro 
Dim oShell 
Set oShell = CreateObject("Wscript.Shell") 
oShell.Run ("cmd") 
Application.Wait DateAdd("s", 1, Now) 
oShell.AppActivate "C:\SYSROOT\system32\cmd.exe" 

Application.Wait DateAdd("s", 1, Now) 
oShell.SendKeys "inetcpl.cpl" 
oShell.SendKeys "{enter}" 
oShell.AppActivate "Internet Properties" 
Application.Wait DateAdd("s", 1, Now) 
oShell.SendKeys "^{TAB 3}" 
oShell.SendKeys "{Tab}" 

oShell.SendKeys "{enter}" 
oShell.SendKeys "{enter}" 
oShell.SendKeys "{Tab 6}" 
oShell.SendKeys "{enter}" 
Application.Wait DateAdd("s", 1, Now) 

oShell.AppActivate "C:\SYSROOT\system32\cmd.exe" 
oShell.SendKeys "exit" 
oShell.SendKeys "{enter}" 

End Sub 

會很感激,如果有人請建議任何選擇清除SSL狀態以及使用VBScript。

非常感謝:)

+0

SSL意味着安全套接字層,而不是安全殼,因此您需要重新考慮您的腳本。 –

回答

4

插裝時與Process Monitor控制面板操作(的偉大事業,順便說一句),它看起來像當按下清除SSL狀態按鈕時,執行以下命令:

"C:\Windows\system32\rundll32.exe" "C:\Windows\system32\WININET.dll",DispatchAPICall 3 
+0

感謝Ingo,我會嘗試並更新你。 – codeomnitrix