我想請問一下,我根據rho123大大內的帖子,做修改想要擷取這個網頁的圖形(http://allsharing.net/drupal_5_1/lineworld/fund/html/0676.htm),始終無法順利擷取,都會出現以下的錯誤訊息:
請問一下大家該如何修正程式碼?
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
$Form1 = GUICreate("加載網頁中的圖片顯示:", 333, 211)
$Label1 = GUICtrlCreateLabel("圖片X:", 16,43, 70, 17)
GUICtrlSetFont(-1, 12, 400, 0, "黑體")
GUICtrlSetColor(-1, 0xFF0000)
;$Button1 = GUICtrlCreateButton("更換驗證碼", 112, 150, 97, 33, 0)
$oIE_code = _IECreateEmbedded ()
$GUIActiveX = GUICtrlCreateObj($oIE_code, 80,24,200,100);定義內嵌IE 窗口大小
_IENavigate ($oIE_code, "about:blank",1)
;加載一個空白網頁,可以自定一個網頁,讓驗證碼圖片顯示左左對齊,頂部對齊,如果你會HTML應該明白什麼意思
$oBody = _IETagNameGetCollection($oIE_code, "body", 0)
_IEDocInsertHTML($oBody, 'IE加載中...', "afterbegin");在嵌入IE底部追加文字
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;$oIE = _IECreate ("https://login.sina.com.cn/cgi/register/reg_sso.php");打開帶驗證碼的網頁,可以隱藏IE
$oIE = _IECreate ("http://allsharing.net/drupal_5_1/lineworld/fund/html/0676.htm");打開帶驗證碼的網頁,可以隱藏IE
Get_code()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_IEQuit ($oIE);退出腳本關閉IE
Exit
EndSwitch
WEnd
Func Get_code()
;$oImg = _IEImgGetCollection ($oIE,4);返回IE文檔內IMG 實際上就是第4+1張圖
$oImg = _IEImgGetCollection ($oIE,1);返回IE文檔內IMG 實際上就是第1張圖
$oPic = $oIE.Document.body.createControlRange()
$oPic.Add($oImg)
$oPic.execCommand("Copy");複製到剪貼板
$ImageFilePath = ClipGet();獲取路徑,在臨時文件裡面
_IEAction ( $oIE_code,"refresh" );刷新嵌入IE頁面
$oBody = _IETagNameGetCollection($oIE_code, "body", 0)
_IEDocInsertHTML($oBody, '<img src='& FileGetShortName($ImageFilePath) &'>', "afterbegin");在嵌入IE底部追加圖片顯示
EndFunc
[ 本帖最后由 fancky 于 2009-2-25 09:35 编辑 ] |