abiteric Posted June 6, 2008 Share Posted June 6, 2008 (edited) i want to catch the message from Yahoo messanger by others send to me the class is "YHTMLContainer" , ClassnameNN is "YHTMLContainer1" Define the target (all succest) $tg_handle = WinGetHandle("[class:ATL:007AD158]") $tg_title = WinGetTitle ( "[class:ATL:007AD158]" ) WinGetClassList ($tg_title,"") i try those way but all failure : WingetText ($tg_title,"") ControlGetText ($tg_title,"","[class:YHTMLContainer1]") ControlCommand ($tg_title,"","YHTMLContainer1","GetLine",0) need your help and thanks~ Edited June 6, 2008 by abiteric My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909 Link to comment Share on other sites More sharing options...
Airwolf Posted June 6, 2008 Share Posted June 6, 2008 You could do it by reading window text, or you could develop more tightly integrated with the messenger client itself:http://developer.yahoo.com/messenger/ Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
abiteric Posted June 6, 2008 Author Share Posted June 6, 2008 You could do it by reading window text, or you could develop more tightly integrated with the messenger client itself:http://developer.yahoo.com/messenger/but i`m a newbie about coding.... i don`t know how to use http://developer.yahoo.com/messenger/ (i`ve download it already... so i try to use Autoit ) My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909 Link to comment Share on other sites More sharing options...
Airwolf Posted June 6, 2008 Share Posted June 6, 2008 I think you're overcomplicating it. This should read text from the specified window and display it in a MsgBox. $chattext = WinGetText("[class:ATL:007AD158]","") MsgBox(0,"",$chattext) Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
abiteric Posted June 6, 2008 Author Share Posted June 6, 2008 I think you're overcomplicating it. This should read text from the specified window and display it in a MsgBox. $chattext = WinGetText("[class:ATL:007AD158]","") MsgBox(0,"",$chattext) no~ it was pop the message : Arial 9 (what i set the Fonts in Yahoo! Messager) WingetText ($tg_title,"") <----- i`ve try but the result was same as WinGetText("[class:ATL:007AD158]","") PS: if i use Yahoo! offical plugins to work the function , all MSN user need change to Yahoo... sorry for my poor English ><" My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909 Link to comment Share on other sites More sharing options...
Airwolf Posted June 6, 2008 Share Posted June 6, 2008 Use ControlGetText() instead and specify the control in the window (use the Window Info tool). ControlGetText("[class:ATL:007AD158]","","idofcontrol") Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
abiteric Posted June 6, 2008 Author Share Posted June 6, 2008 Use ControlGetText() instead and specify the control in the window (use the Window Info tool). ControlGetText("[class:ATL:007AD158]","","idofcontrol") failure.... there is the message copy from Autoit Window Info >>>> Window <<<< Title: abiteric@hotmail.com - abiteric Class: ATL:007AD158 Position: 527, 228 Size: 400, 562 Style: 0x16CF0000 ExStyle: 0x00000100 Handle: 0x000C0E46 >>>> Control <<<< Class: YHTMLContainer Instance: 1 ClassnameNN: YHTMLContainer1 ID: 106300308 Text: Position: 3, 72 Size: 388, 338 ControlClick Coords: 268, 167 Style: 0x56000000 ExStyle: 0x02010000 Handle: 0x00280E26 >>>> Mouse <<<< Position: 271, 239 Cursor ID: 2 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> Visible Text <<<< >>>> Hidden Text <<<< Arial 9 i try to google "vb6 get yahoo YHTMLContainer" i find a link http://www.vbforums.com/showthread.php?t=357460 but the solution link was lost.... My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909 Link to comment Share on other sites More sharing options...
Airwolf Posted June 6, 2008 Share Posted June 6, 2008 This doesn't work? $chattxt = ControlGetText("[CLASS:ATL:007AD158]","","106300308") MsgBox(0,"",$chattxt) If so, what is the error or output? Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
abiteric Posted June 6, 2008 Author Share Posted June 6, 2008 This doesn't work? $chattxt = ControlGetText("[CLASS:ATL:007AD158]","","106300308") MsgBox(0,"",$chattxt) If so, what is the error or output? @error = 1 , output nothing i find a link , but it`s need to pay =.=! http://www.experts-exchange.com/Programmin...Q_21284960.html My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 6, 2008 Moderators Share Posted June 6, 2008 Well, the link you sent us too... kind of says it all, if he's using DOM, maybe you should follow suit? #include <ie.au3> ; Tested with 3.2.11.1 Global $hWnd, $oIE, $sBody $hWnd = WinGetHandle("[CLASS:IMClass]") $oIE = _IEAttach($hWnd, "embedded") If IsObj($oIE) = 0 Then MsgBox(64, "Info", "Error attaching, are you sure you're using AutoIt 3.2.11.1 and above?") Exit EndIf ;If you want a lot of info, use _IEBodyReadHTML $sBody = _IEBodyReadText($oIE) MsgBox(0, 0, $sBody) IE.au3 isn't just for using on web pages... when you see internet explorer_server1 ... you're pretty good to go. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
abiteric Posted June 6, 2008 Author Share Posted June 6, 2008 if this is the solution, how do i make it in Autoit ?post from google search : http://209.85.175.104/search?q=cache:ivBPJ...;cd=2&gl=tw expandcollapse popupHere is how you go about Yahoo. the following code snippet will capture all text from yahoo private IM windows and save it to a file in App.Path\YIMMessage.txt file. Create a New Project. Add Reference to Microsoft HTML Object Library 'Add this to a Module Option Explicit Public Type UUID Data1 As Long Data2 As Integer Data3 As Integer Data4(0 To 7) As Byte End Type Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Public Declare Function ObjectFromLresult Lib "oleacc" (ByVal lResult As Long, riid As UUID, ByVal wParam As Long, ppvObject As Any) As Long Public Declare Function RegisterWindowMessage Lib "user32" Alias "RegisterWindowMessageA" (ByVal lpString As String) As Long Public Declare Function SendMessageTimeout Lib "user32" Alias "SendMessageTimeoutA" (ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, lParam As Any, ByVal fuFlags As Long, ByVal uTimeout As Long, lpdwResult As Long) As Long Public Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Boolean Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long Public Declare Function SendMessageLong& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long Public Const SMTO_ABORTIFHUNG = &H2 Public Const WM_GETTEXT = &HD Public Const WM_GETTEXTLENGTH = &HE Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Boolean Dim Ret As Long Dim objDoc As HTMLDocument Dim lpClassName As String Dim RetVal As Long Dim sText As String Dim sTitle As String 'Create a buffer lpClassName = Space(256) 'retrieve the class name RetVal = GetClassName(hwnd, lpClassName, 256) If InStr(1, lpClassName, "YSearchMenuWndClass", vbTextCompare) > 0 Then sTitle = GetWindowTitle(hwnd) hwnd = FindWindowEx(hwnd, 0, "IMClass", vbNullString) hwnd = FindWindowEx(hwnd, 0, "YHTMLContainer", vbNullString) hwnd = FindWindowEx(hwnd, 0, "Internet Explorer_Server", vbNullString) If hwnd > 0 Then Set objDoc = WindowDOM(hwnd) If Not (objDoc Is Nothing) Then sText = objDoc.body.innerText End If SaveMessages sTitle + sText End If End If 'continue enumeration EnumWindowsProc = True End Function Private Function WindowDOM(ByVal hwnd As Long) As IHTMLDocument Dim typUUID As UUID, lngRes As Long, lngMsg As Long lngMsg = RegisterWindowMessage("WM_HTML_GETOBJECT") If lngMsg <> 0 Then Call SendMessageTimeout(hwnd, lngMsg, 0, 0, SMTO_ABORTIFHUNG, 1000, lngRes) If lngRes <> 0 Then With typUUID .Data1 = &H626FC520 .Data2 = &HA41E .Data3 = &H11CF .Data4(0) = &HA7 .Data4(1) = &H31 .Data4(2) = &H0 .Data4(3) = &HA0 .Data4(4) = &HC9 .Data4(5) = &H8 .Data4(6) = &H26 .Data4(7) = &H37 End With Call ObjectFromLresult(lngRes, typUUID, 0, WindowDOM) End If End If End Function Private Function GetWindowTitle(ByVal hwnd As Long) As String Dim TheText As String, TL As Long TL = SendMessageLong(hwnd&, WM_GETTEXTLENGTH, 0&, 0&) TheText = String(TL + 1, " ") Call SendMessageByString(hwnd&, WM_GETTEXT, TL + 1, TheText) GetWindowTitle = Left(TheText, Len(TheText) - 1) End Function Private Function SaveMessages(strData As String) Dim f As Long f = FreeFile Open App.Path & "\YIMMessage.txt" For Append As #f Print #f, strData Close #f End Function 'Add the following to Form Load Option Explicit Private Sub Form_Load() Dim hwnd As Long, objDoc As HTMLDocument 'YSearchMenuWndClass is the class name of yahoo PM window hwnd = FindWindow("YSearchMenuWndClass", vbNullString) EnumWindows AddressOf EnumWindowsProc, ByVal 0& Me.Show End Sub My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909 Link to comment Share on other sites More sharing options...
abiteric Posted June 6, 2008 Author Share Posted June 6, 2008 Well, the link you sent us too... kind of says it all, if he's using DOM, maybe you should follow suit? #include <ie.au3> ; Tested with 3.2.11.1 Global $hWnd, $oIE, $sBody $hWnd = WinGetHandle("[CLASS:IMClass]") $oIE = _IEAttach($hWnd, "embedded") If IsObj($oIE) = 0 Then MsgBox(64, "Info", "Error attaching, are you sure you're using AutoIt 3.2.11.1 and above?") Exit EndIf ;If you want a lot of info, use _IEBodyReadHTML $sBody = _IEBodyReadText($oIE) MsgBox(0, 0, $sBody) IE.au3 isn't just for using on web pages... when you see internet explorer_server1 ... you're pretty good to go. thanks~ but must use in 3.2.11.1 ? i use 3.2.11.2 d:\Program Files\AutoIt3\Include\IE.au3 (4088) : ==> Subscript used with non-Array variable.: If IsObj($aRet[4]) Then If IsObj($aRet^ ERROR ->01:28:29 AutoIT3.exe ended.rc:1 >Exit code: 1 Time: 4.147 my code: #Include <WinAPI.au3> #include <IE.au3> opt("WinDetectHiddenText",1) opt("WinTextMatchMode",2) $tg_handle = WinGetHandle("[class:ATL:007AD158]") $tg_title = WinGetTitle ( "[class:ATL:007AD158]" ) MsgBox (0,$tg_title ,$tg_handle) Global $hWnd, $oIE, $sBody $hWnd = WinGetHandle("[class:ATL:007AD158]") $oIE = _IEAttach($hWnd, "embedded") If IsObj($oIE) = 0 Then MsgBox(64, "Info", "Error attaching, are you sure you're using AutoIt 3.2.11.1 and above?") Exit EndIf ;If you want a lot of info, use _IEBodyReadHTML $sBody = _IEBodyReadText($oIE) MsgBox(0, 0, $sBody) My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 6, 2008 Moderators Share Posted June 6, 2008 You're way behind the times (even I am saying 3.2.11.1)... time for you to upgrade if you want to use current scripts on this forum. I tested it and it worked... that's all I can say. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
abiteric Posted June 6, 2008 Author Share Posted June 6, 2008 You're way behind the times (even I am saying 3.2.11.1)... time for you to upgrade if you want to use current scripts on this forum.I tested it and it worked... that's all I can say.wow...... how do i get the 3.2.11.1....... can`t find the download link My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909 Link to comment Share on other sites More sharing options...
Andreik Posted June 6, 2008 Share Posted June 6, 2008 wow...... how do i get the 3.2.11.1....... can`t find the download link http://www.autoitscript.com/autoit3/files/beta/autoit/ When the words fail... music speaks. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted June 6, 2008 Share Posted June 6, 2008 The beta was created before the stable, hence get the stable .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
abiteric Posted June 6, 2008 Author Share Posted June 6, 2008 You're way behind the times (even I am saying 3.2.11.1)... time for you to upgrade if you want to use current scripts on this forum.I tested it and it worked... that's all I can say.good! i use 3.2.12.0 is ok! love u ~~~~~ My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909 Link to comment Share on other sites More sharing options...
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