使用vbscript下载文件

时间:2014-06-23 15:06:02

标签: vbscript

我在下载文件时遇到问题,我有两个URL是用户和pwd的第一个URL内容,第二个URL内容是我需要的文件的路径。

如果只将第二个URL显示为错误消息。我在VBScript中很开心。

我只想下载文件

这是我的代码,但我不知道是否正确。

Function Main       
    Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
    IE.Visible = False
    IE.Navigate "url/sf_security_check?j_username=myuser&j_password=mypwd" '-- First URL     
Call Extrae_Arc

End Function

Function Extrae_Arc
    Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
    IE.Visible = True
    IE.Navigate "url" '-- second URL
End Function

感谢您的帮助

1 个答案:

答案 0 :(得分:0)

IE 对象在 Extrae_Arc 函数中重新定义,因此会覆盖先前分配的指针。 我将使用下一个场景:

'...
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
Call Main
Call Extrae_Arc
'...

Function Main
  IE.Visible = False
  IE.Navigate "url/sf_security_check?j_username=myuser&j_password=mypwd" '-- First URL
End Function

Function Extrae_Arc
  IE.Visible = True
  IE.Navigate "url" '-- second URL
End Function
相关问题