GMib Posted March 6, 2010 Posted March 6, 2010 (edited) This is an example of embedded HTMLayout activex.Download HTMLayout SDK and register \bin\AxHTMLayout.dll before run exampleexpandcollapse popup#include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") const $BE_BUTTON_CLICK = 0 const $BE_BUTTON_PRESS = 1 const $BE_BUTTON_STATE_CHANGED = 2 const $BE_EDIT_VALUE_CHANGING = 3 const $BE_EDIT_VALUE_CHANGED = 4 const $BE_SELECT_SELECTION_CHANGED = 5 const $BE_SELECT_STATE_CHANGED = 6 const $BE_POPUP_REQUEST = 7 const $BE_POPUP_READY = 8 const $BE_POPUP_DISMISSED = 9 const $BE_MENU_ITEM_ACTIVE = 10 const $BE_MENU_ITEM_CLICK = 11 const $BE_CONTEXT_MENU_SETUP = 15 const $BE_CONTEXT_MENU_REQUEST = 16 const $BE_VISIUAL_STATUS_CHANGED = 17 const $BE_HYPERLINK_CLICK = 128 const $BE_TABLE_HEADER_CLICK = $BE_HYPERLINK_CLICK + 1 ;129 const $BE_TABLE_ROW_CLICK = $BE_TABLE_HEADER_CLICK + 1 ;130 const $BE_TABLE_ROW_DBL_CLICK = $BE_TABLE_ROW_CLICK + 1 ;131 const $BE_ELEMENT_COLLAPSED = 144 const $BE_ELEMENT_EXPANDED = $BE_ELEMENT_COLLAPSED + 1 ;145 const $BE_ACTIVATE_CHILD = $BE_ELEMENT_EXPANDED + 1 ;146 const $BE_DO_SWITCH_TAB = $BE_ACTIVATE_CHILD ;146 const $BE_INIT_DATA_VIEW = $BE_DO_SWITCH_TAB + 1 ;147 const $BE_ROWS_DATA_REQUEST = $BE_INIT_DATA_VIEW + 1 ;148 const $BE_UI_STATE_CHANGED = $BE_ROWS_DATA_REQUEST + 1 ;149 const $BE_FORM_SUBMIT = $BE_UI_STATE_CHANGED + 1 ;150 const $BE_FORM_RESET = $BE_FORM_SUBMIT + 1 ;151 const $BE_DOCUMENT_COMPLETE = $BE_FORM_RESET + 1 ;152 const $BE_HISTORY_PUSH = $BE_DOCUMENT_COMPLETE + 1 ;153 const $BE_HISTORY_DROP = $BE_HISTORY_PUSH + 1 ;154 const $BE_HISTORY_PRIOR = $BE_HISTORY_DROP + 1 ;155 const $BE_HISTORY_NEXT = $BE_HISTORY_PRIOR + 1 ;156 const $BE_HISTORY_STATE_CHANGED = $BE_HISTORY_NEXT + 1 ;157 const $BE_FIRST_APPLICATION_EVENT_CODE = 256 $Form1 = GUICreate("Form1", 800, 550, 10, 50,$WS_POPUP, $WS_EX_LAYERED) $size = WinGetClientSize ($Form1) GUISetBkColor(0xABCDEF) $Obj1 = ObjCreate("AxHTMLayout.Engine.1") $Obj1_ctrl = GUICtrlCreateObj($Obj1, 0, 0, $size[0],$size[1]) $Oevent = ObjEvent($Obj1,"event_") _WinAPI_SetLayeredWindowAttributes($Form1, 0xABCDEF, 250) GUISetState(@SW_SHOW) $Obj1.Load('file://'&@scriptdir&'\sliding-list.htm') While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_SECONDARYUP Exit EndSwitch WEnd func event_onControlEvent($element, $eventtype,$reason,$handled) ConsoleWrite($eventtype&@CRLF) if $eventtype = $BE_HYPERLINK_CLICK then If $element.attribute("id") = "CloseGui" Then Exit EndIf if $eventtype = $BE_BUTTON_CLICK then If $element.attribute("id") = "buttonclick" Then MsgBox("","Button Test","Button Click Event") EndIf if $eventtype = $BE_ELEMENT_COLLAPSED then ConsoleWrite('Collapsed: '&$element.attribute("id")&@CRLF) EndIf if $eventtype = $BE_ELEMENT_EXPANDED then ConsoleWrite('Expanded: '&$element.attribute("id")&@CRLF) EndIf EndFunc func event_DocumentLoaded() $O2event = ObjEvent($Obj1.root,"event_","_IElementEvents") EndFunc ;This is COM error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Consolewrite("We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns EndfuncEdit: add COM Error handler (suggest of ptrex)HTMLayout.zip Edited March 12, 2010 by GMib
zackrspv Posted March 9, 2010 Posted March 9, 2010 This is an example of embedded HTMLayout activex.Download HTMLayout SDK and register \bin\AxHTMLayout.dll before run exampleThis is a very nice find. Not only is the licence 100% for commercial and private use, but the functionality is wonderful. I'm going to be using this in one of my xmpp servers shortly.The most appealing thing about this particular COM object is that you can script web events and capture the events in autoit. So, if you have an accordian, like slider (in csss), for example, to give you a menu like outlook has, you can respond to events, etc, inside of autoit as you would on a website.I'm stoked. To be able to capture web events like that in autoit, without having to do anything msssively conpples, and still be able to use the HTML dom to control and edit information inside of the viewer? Awesome.Good job finding this one. -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ†ƒë@®, wï†høµ††ïmë, @ñd wï†høµ†@ †ïmïdï†ÿ ƒø® !ïƒë. €×阮ñø†, bµ†ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ††hë ë§§ëñ§ë øƒ !ïƒë.
JRSmile Posted March 9, 2010 Posted March 9, 2010 (edited) im not able to do a regsvr32.exe AxHTMLayout.dll or htmlayout.dll, how do i get this com object then? if not registered, the example crashes with: $Obj1.Load('file://'&@scriptdir&'\sliding-list.htm') $Obj1^ ERROR of course... after some tweaking here moving there i finally managed to register the dll..... Very nice find indeet, will use it a lot in the future. Edited March 10, 2010 by JRSmile $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
JohnnyThrash Posted March 11, 2010 Posted March 11, 2010 This is an example of embedded HTMLayout activex. Download HTMLayout SDK and register \bin\AxHTMLayout.dll before run example expandcollapse popup#include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> const $BE_BUTTON_CLICK = 0 const $BE_BUTTON_PRESS = 1 const $BE_BUTTON_STATE_CHANGED = 2 const $BE_EDIT_VALUE_CHANGING = 3 const $BE_EDIT_VALUE_CHANGED = 4 const $BE_SELECT_SELECTION_CHANGED = 5 const $BE_SELECT_STATE_CHANGED = 6 const $BE_POPUP_REQUEST = 7 const $BE_POPUP_READY = 8 const $BE_POPUP_DISMISSED = 9 const $BE_MENU_ITEM_ACTIVE = 10 const $BE_MENU_ITEM_CLICK = 11 const $BE_CONTEXT_MENU_SETUP = 15 const $BE_CONTEXT_MENU_REQUEST = 16 const $BE_VISIUAL_STATUS_CHANGED = 17 const $BE_HYPERLINK_CLICK = 128 const $BE_TABLE_HEADER_CLICK = $BE_HYPERLINK_CLICK + 1 ;129 const $BE_TABLE_ROW_CLICK = $BE_TABLE_HEADER_CLICK + 1 ;130 const $BE_TABLE_ROW_DBL_CLICK = $BE_TABLE_ROW_CLICK + 1 ;131 const $BE_ELEMENT_COLLAPSED = 144 const $BE_ELEMENT_EXPANDED = $BE_ELEMENT_COLLAPSED + 1 ;145 const $BE_ACTIVATE_CHILD = $BE_ELEMENT_EXPANDED + 1 ;146 const $BE_DO_SWITCH_TAB = $BE_ACTIVATE_CHILD ;146 const $BE_INIT_DATA_VIEW = $BE_DO_SWITCH_TAB + 1 ;147 const $BE_ROWS_DATA_REQUEST = $BE_INIT_DATA_VIEW + 1 ;148 const $BE_UI_STATE_CHANGED = $BE_ROWS_DATA_REQUEST + 1 ;149 const $BE_FORM_SUBMIT = $BE_UI_STATE_CHANGED + 1 ;150 const $BE_FORM_RESET = $BE_FORM_SUBMIT + 1 ;151 const $BE_DOCUMENT_COMPLETE = $BE_FORM_RESET + 1 ;152 const $BE_HISTORY_PUSH = $BE_DOCUMENT_COMPLETE + 1 ;153 const $BE_HISTORY_DROP = $BE_HISTORY_PUSH + 1 ;154 const $BE_HISTORY_PRIOR = $BE_HISTORY_DROP + 1 ;155 const $BE_HISTORY_NEXT = $BE_HISTORY_PRIOR + 1 ;156 const $BE_HISTORY_STATE_CHANGED = $BE_HISTORY_NEXT + 1 ;157 const $BE_FIRST_APPLICATION_EVENT_CODE = 256 $Form1 = GUICreate("Form1", 800, 550, 10, 50,$WS_POPUP, $WS_EX_LAYERED) $size = WinGetClientSize ($Form1) GUISetBkColor(0xABCDEF) $Obj1 = ObjCreate("AxHTMLayout.Engine.1") $Obj1_ctrl = GUICtrlCreateObj($Obj1, 0, 0, $size[0],$size[1]) $Oevent = ObjEvent($Obj1,"event_") _WinAPI_SetLayeredWindowAttributes($Form1, 0xABCDEF, 250) GUISetState(@SW_SHOW) $Obj1.Load('file://'&@scriptdir&'\sliding-list.htm') While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_SECONDARYUP Exit EndSwitch WEnd func event_onControlEvent($element, $eventtype,$reason,$handled) ConsoleWrite($eventtype&@CRLF) if $eventtype = $BE_HYPERLINK_CLICK then If $element.attribute("id") = "CloseGui" Then Exit EndIf if $eventtype = $BE_BUTTON_CLICK then If $element.attribute("id") = "buttonclick" Then MsgBox("","Button Test","Button Click Event") EndIf if $eventtype = $BE_ELEMENT_COLLAPSED then ConsoleWrite('Collapsed: '&$element.attribute("id")&@CRLF) EndIf if $eventtype = $BE_ELEMENT_EXPANDED then ConsoleWrite('Expanded: '&$element.attribute("id")&@CRLF) EndIf EndFunc func event_DocumentLoaded() $O2event = ObjEvent($Obj1.root,"event_","_IElementEvents") EndFunc Wow This is incredible. I had no idea something like this existed. This is actually exactly what I need for my project and exactly when I needed it. Thanks for this example you have no idea how much this has helped me. Although I was looknig through HTMLayout's help file. I couldn't understand any of it. C++ and object oriented languages in general are too much for me. Confused the hell out of me. How can I find a list of functions for this? I'm interested in forcing the document to refresh. Do you know how I can do that? If someone here where to make a file of UDFs out of this I'd say they were a king.
sheeva Posted March 11, 2010 Posted March 11, 2010 Hi,Seems to be very good but, tell me what kind of winapi.au3 include you are using because i dont have _WinAPI_SetLayeredWindowAttributes functionIn my WinAPI.au3 include this function doesn't exist.This function exist in WinAPIEx.au3 but with not the same number of arguments.Thank's.
GMib Posted March 11, 2010 Author Posted March 11, 2010 How can I find a list of functions for this? I'm interested in forcing the document to refresh. Do you know how I can do that? i find function in AxHTMLayout\AxHTMLayout.idl of SDK and in vb exemple AxHTMLayout\vb you can use autocompletion of visual basic for find function or property too. for refresh document, you can use $obj.LoadHtml for load string. Hi, Seems to be very good but, tell me what kind of winapi.au3 include you are using because i dont have _WinAPI_SetLayeredWindowAttributes function In my WinAPI.au3 include this function doesn't exist. This function exist in WinAPIEx.au3 but with not the same number of arguments. Thank's. i use WinAPI.au3 from autoit Func _WinAPI_SetLayeredWindowAttributes($hWnd, $i_transcolor, $Transparency = 255, $dwFlags = 0x03, $isColorRef = False) If $dwFlags = Default Or $dwFlags = "" Or $dwFlags < 0 Then $dwFlags = 0x03 If Not $isColorRef Then $i_transcolor = Hex(String($i_transcolor), 6) $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2)) EndIf Local $aResult = DllCall("user32.dll", "bool", "SetLayeredWindowAttributes", "hwnd", $hWnd, "dword", $i_transcolor, "byte", $Transparency, "dword", $dwFlags) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] EndFunc ;==>_WinAPI_SetLayeredWindowAttributes
ptrex Posted March 11, 2010 Posted March 11, 2010 @GMib Very nice ! I would suggest to add the COM Error handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") Code here ... ;This is COM error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"COM Error Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc Rgds, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
sheeva Posted March 12, 2010 Posted March 12, 2010 Hi, Sorry, i have used a OLD version of Autoit (3.3.0.0) now it's fixed and working perfectly with the 3.3.6.0 update. If somebody can begin an UDF with this it will be great ! nice work.
JohnnyThrash Posted March 12, 2010 Posted March 12, 2010 Hi,Sorry, i have used a OLD version of Autoit (3.3.0.0) now it's fixed and working perfectly with the 3.3.6.0 update. If somebody can begin an UDF with this it will be great !nice work.I completely agree. I think if somebody with a bit of know how were to develope a UDF for this would certainly change the way many, if not most, autoit applications are developed.By the way, I realize I'm asking for a bit much, but could somebody possibley give me a list of functions to use with this? I've looked though the idl file and I feel like an invalid, I can't make sense of it at all.
GMib Posted March 12, 2010 Author Posted March 12, 2010 I completely agree. I think if somebody with a bit of know how were to develope a UDF for this would certainly change the way many, if not most, autoit applications are developed.for UDF, dll version of htmlayout is better (no need to register activex), but i don't know how to use dll. By the way, I realize I'm asking for a bit much, but could somebody possibley give me a list of functions to use with this? I've looked though the idl file and I feel like an invalid, I can't make sense of it at all. What fonction you search ? i can try to develop an exemple of what you need, but i can't explain you because i'm noob in com and object and i'm french (It's very difficult for me to express me correctly)
JohnnyThrash Posted March 14, 2010 Posted March 14, 2010 for UDF, dll version of htmlayout is better (no need to register activex), but i don't know how to use dll. What fonction you search ? i can try to develop an exemple of what you need, but i can't explain you because i'm noob in com and object and i'm french (It's very difficult for me to express me correctly)Well, i'm simply trying find a decent method by which i can fresh the page. "Load" adds alot of virtual memory usage as if I were duplicating the document. And I'm not sure what parameters to pass LoadHtml. So I really don't know how to properly refresh this.
GMib Posted March 14, 2010 Author Posted March 14, 2010 Why refresh a gui ? if refresh exist, it's refrech nothing : $obj.LoadHtml('<html><body><h1 id="ex">test</h1></body></html>') $obj.refresh does nothing if you want change h1 value you can try use $m = $obj.root.Select("#ex") and $m.Value = "change" else $obj.LoadHtml('<html><body><h1 id="ex">Change</h1></body></html>') i failed to use SelectAll HRESULT SelectAll([in] BSTR cssSelector, [out,retval] IElements** ppEls); = "Returns enumerable collection of all subelemts matching the selector" when i use for $el in $var autoit crash.
JohnnyThrash Posted March 14, 2010 Posted March 14, 2010 Why refresh a gui ? if refresh exist, it's refrech nothing : $obj.LoadHtml('<html><body><h1 id="ex">test</h1></body></html>') $obj.refresh does nothing if you want change h1 value you can try use $m = $obj.root.Select("#ex") and $m.Value = "change" else $obj.LoadHtml('<html><body><h1 id="ex">Change</h1></body></html>') i failed to use SelectAll HRESULT SelectAll([in] BSTR cssSelector, [out,retval] IElements** ppEls); = "Returns enumerable collection of all subelemts matching the selector" when i use for $el in $var autoit crash. Thanks, this is all useful information to me. But I don't mean to refresh the gui, but the .html page I have loaded in it. Reason being is that behind the scenes i change a file that it includes and need to refresh the html page to see the changes.
GMib Posted March 14, 2010 Author Posted March 14, 2010 Thanks, this is all useful information to me. But I don't mean to refresh the gui, but the .html page I have loaded in it. Reason being is that behind the scenes i change a file that it includes and need to refresh the html page to see the changes. you can use $obj.Load or read file in string and Loadhtml string. i use this for testing : Case $GUI_EVENT_SECONDARYUP $Obj1.Load('file://'&@scriptdir&'\Layout.htm') Right click on gui reload the file.
JohnnyThrash Posted March 14, 2010 Posted March 14, 2010 you can use $obj.Load or read file in string and Loadhtml string. i use this for testing : Case $GUI_EVENT_SECONDARYUP $Obj1.Load('file://'&@scriptdir&'\Layout.htm') Right click on gui reload the file. Yeah, but bring up your task manager and see how much memory your program uses when you use "load" it, it adds like at 10,000K every time it is loaded.
GMib Posted March 14, 2010 Author Posted March 14, 2010 Yeah, but bring up your task manager and see how much memory your program uses when you use "load" it, it adds like at 10,000K every time it is loaded.i don't know why memory up, i try vb example and it do same.Events increase memory too.perhaps solution is delete and create object for each htm file change.
JohnnyThrash Posted March 14, 2010 Posted March 14, 2010 i don't know why memory up, i try vb example and it do same. Events increase memory too. perhaps solution is delete and create object for each htm file change. It's very bad that events also increase memory. But I was looking through the source of the browser example and found this line ::PostMessage(GetParent(),WM_COMMAND,WPARAM(ID_FILE_RELOAD),LPARAM(m_hWnd)); This seems like it would do the trick. Although I'm not sure what the function for this is supposed to look like. I'm a bit of a newb and not quite savvy enough to figure it out.
JohnnyThrash Posted March 15, 2010 Posted March 15, 2010 By the way, How can I use $element.position to retrieve an elements position? I can't figure out how to use it.
GMib Posted March 15, 2010 Author Posted March 15, 2010 By the way, How can I use $element.position to retrieve an elements position? I can't figure out how to use it.i don't know, all my test are failed. sorry
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