lebobo Posted May 31, 2006 Posted May 31, 2006 I try to write a script to monitor all websites visited with IE on a PC. I'd like to get a log file like : 21:03:33 http://www.cyberliege.be/DIVERS/pages_services/radios.shtml 21:03:40 http://www.immo2000jemeppe.be/ 21:04:00 http://www.ebay.com/ Here is some code... but I don't know how to get $obj variable as soon I visit a new website. If $obj.document.url <> $temp Then $temp = $obj.document.url $file = FileOpen("test.txt", 1) FileWrite($file, @HOUR & ":" & @MIN & ":" & @SEC & " "& $obj.document.url & @CRLF) FileClose($file) EndIf Could you help me to develop this script ?
Valuater Posted May 31, 2006 Posted May 31, 2006 i would use _FileWriteLog() it replaces all of this $file = FileOpen("test.txt", 1) FileWrite($file, @HOUR & ":" & @MIN & ":" & @SEC & " "& $obj.document.url & @CRLF) FileClose($file) 8)
lebobo Posted June 1, 2006 Author Posted June 1, 2006 (edited) _FileWriteLog() is a very good function ! Thanks !!!Do you have idea how I can get "$obj" variable ?Regards,Bruno Edited June 1, 2006 by lebobo
w0uter Posted June 1, 2006 Posted June 1, 2006 ie.au3 ? My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
lebobo Posted June 1, 2006 Author Posted June 1, 2006 Here is my complete code. It works but program exits if I quit IE or when I open a second IE window.... Could you help me to solve this problem ? expandcollapse popup#include <ie.au3> Dim $Win_hWnd,$IE_hWnd Dim $obj,$oForm Dim $Ctrl_List Dim $n Dim $temp $temp = "" While 1 $Win_hWnd = WinGetHandle("") $Ctrl_List = WinGetClassList($Win_hWnd) If Not @error And StringInStr($Ctrl_List,"Internet Explorer_Server" & @LF) Then $n = 1 While 1 $IE_hWnd = ControlGetHandle($Win_hWnd,"","Internet Explorer_Server" & $n) If @error Then ExitLoop If ControlCommand($Win_hWnd,"","Internet Explorer_Server" & $n,"IsVisible","") Then $obj = _ObjGetFromHWND($IE_hWnd) If IsObj($obj) Then If $obj.document.url <> $temp Then $temp = $obj.document.url $file = FileOpen("test.txt", 1) FileWrite($file, @HOUR & ":" & @MIN & ":" & @SEC & " "& $obj.document.url & @CRLF) FileClose($file) EndIf Sleep(100) EndIf EndIf $n += 1 WEnd EndIf WEnd Func _ObjGetFromHWND(ByRef $hWin) DLLCall("ole32.dll","int","CoInitialize","ptr",0) If @error Then Return SetError(@error,@extended,0) Local Const $WM_HTML_GETOBJECT = _RegisterWindowMessage("WM_HTML_GETOBJECT") If @error Then Return SetError(@error,@extended,0) Local Const $SMTO_ABORTIFHUNG = 0x0002 Local $lResult, $typUUID, $aRet, $oIE _SendMessageTimeout($hWin, $WM_HTML_GETOBJECT, 0, 0, $SMTO_ABORTIFHUNG, 1000, $lResult) If @error Then Return SetError(@error,@extended,0) $typUUID = DLLStructCreate("int;short;short;byte[8]") DLLStructSetData($typUUID,1,0x626FC520) DLLStructSetData($typUUID,2,0xA41E) DLLStructSetData($typUUID,3,0x11CF) DLLStructSetData($typUUID,4,0xA7,1) DLLStructSetData($typUUID,4,0x31,2) DLLStructSetData($typUUID,4,0x0,3) DLLStructSetData($typUUID,4,0xA0,4) DLLStructSetData($typUUID,4,0xC9,5) DLLStructSetData($typUUID,4,0x8,6) DLLStructSetData($typUUID,4,0x26,7) DLLStructSetData($typUUID,4,0x37,8) $aRet = DllCall("oleacc.dll", "int", "ObjectFromLresult", "int", $lResult, _ "ptr", DLLStructGetPtr($typUUID), "int", 0, "idispatch_ptr", "") If @error Then Return SetError(@error,@extended,0) If Not IsObj($aRet[4]) Then Return SetError(1,@extended,0) $oIE = $aRet[4].Script() Return $oIE EndFunc Func _RegisterWindowMessage($sMsg) Local $aRet = DllCall("user32.dll", "int", "RegisterWindowMessage", "str", $sMsg) If @error Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc Func _SendMessageTimeout($hWnd, $msg, $wParam, $lParam, $nFlags, $nTimeout, ByRef $vOut, $r = 0, $t1 = "int", $t2 = "int") Local $aRet = DllCall("user32.dll", "long", "SendMessageTimeout", "hwnd", $hWnd, "int", $msg, $t1, $wParam, $t2, $lParam, "int", $nFlags, "int", $nTimeout, "int_ptr", "") If @error Then $vOut = 0 Return SetError(@error, @extended, 0) EndIf $vOut = $aRet[7] If $r >= 0 And $r <= 4 Then Return $aRet[$r] Return $aRet EndFunc
masvil Posted June 2, 2006 Posted June 2, 2006 Could you help me to solve this problem ?Maybe: http://www.autoitscript.com/forum/index.ph...ndpost&p=138734
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now