本帖最后由 nangua111111 于 2013-3-21 10:22 编辑 #include <ie.au3>
#include <Array.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
#AutoIt3Wrapper_run_debug_mode=Y
$oIE1=_IECreate("http://xlinesoft.com/livedemo/shopcart/admin/login.php");1、建立网页衔接
;$oIE = _IEAttach("http://xlinesoft.com/livedemo/shopcart/admin/login.php")
$Ele1 = _IEGetObjByName($oIE1,"username") ;注意相同name情况,需要第三参数
_IEFormElementSetValue($Ele1,"admin@test.com")
$Ele2 = _IEGetObjByName($oIE1,"password") ;注意相同name情况,需要第三参数
_IEFormElementSetValue($Ele2,"admin")
_IELinkClickByText($oIE1,"Submit")
;;;;;;;;;以上登陆界面;;;;;;;
_IELinkClickByText($oIE1,"States")
$oIEstates=_IEBodyReadHTML($oIE1);获取代码
;MsgBox(0,"",$oIEstates)
;正则表达式获取表格数据
;$open = FileOpen("test.txt",1)
$oIE=_IEAttach("http://xlinesoft.com/livedemo/shopcart/admin/shopstates_list.php","URL")
$oTable=_IETableGetCollection ($oIE ,10)
$array=_IETableWriteToArray($oTable,true)
_ArrayDisplay($array,'Debug~~~')
;sqlite语句
_SQLite_Startup ()
If @error Then
MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
Exit - 1
EndIf
_SQLite_Open(@ScriptDir & "\Database.db") ; 建立打开数据库
If @error Then
MsgBox(16, "SQLite Error", "Can't Load Database!")
Exit - 1
EndIf
_SQLite_Exec (-1, "CREATE TABLE Radio ('"&$array[0][3]&"','"&$array[0][4]&"','"&$array[0][5]&"');");建立表,注意'"&$array[$i][3]&"'表达式
For $i=2 to 21 Step +1
_SQLite_Exec (-1, "INSERT INTO Radio VALUES ('"&$array[$i][3]&"','"&$array[$i][4]&"','"&$array[$i][5]&"');");写入数组,注意'"&$array[$i][3]&"'表达式
next
_SQLite_Close ()
_SQLite_Shutdown ()
|