1

您好我正在尝试在网络上获取一个 excel 文件以使用 AutoIT 自动保存。

以下代码不起作用:

#include <IE.au3>
$oIE = _IECreate ("http://127.0.0.1/my_site")
_IENavigate ($oIE, "http://databases.about.com/library/samples/address.xls")

WinWait("File Download","Do you want to open or save this file?")
ControlClick("File Download","Do you want to open or save this file","Button2")
WinWait("Save As","Save &in:")
4

1 回答 1

1

尝试使用 IE 来做这件事不是正确的方法。

您是否尝试过使用 InetGet 函数?

Local $sFileName = FileSaveDialog("Save excel file...", @MyDocumentsDir, "Excel spreadsheet (*.xls)|All Files (*.*)", 18, "address.xls")
If @error Then Exit ; User cancelled the dialog

Local $iBytes = InetGet("http://databases.about.com/library/samples/address.xls", $sFileName, 8)
MsgBox(0, "Worked :)", "File downloaded. " & $iBytes & " downloaded.")

那行得通,我得到了一个带有地址的下载电子表格(听起来很正确)。

于 2011-04-30T10:45:49.167 回答