Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/08/2016 in all areas

  1. This is a modification of a script that was originally posted back in 2006, that was itself a modification of a script in the same thread, which was a modification of another script linked in that thread. All credits remain in the header as to who contributed to this. The only credit I take in this script is modifying parts of it to: 1.make it a bit faster, by removing a ReDim that was inside a loop 2.add support for OSs other than XP because of the number of file properties returned 3.add support for the future if the number of file properties returned changes again with future versions of Windows Please take note, this script will only work if you know the name of the property you're trying to retrieve. These properties are dependent upon the OS version, the OS language, and the file's properties. This function does not take any of these things into account, if you want to use this and make it OS neutral, you'll have to do that in your script, because it doesn't get done in here. Fortunately, if you access this function and leave the parameter $FGP_Property blank, it will return an array of all the properties that Windows knows about, and in the language that Windows is running in. Windows XP only returns 38 properties, Windows 7 returns 288, Windows 8 returns 290. The same properties can have different names depending on which OS you're using this with. Update Sept. 6, 2017 Changed the code slightly to make sure the return includes all properties, the last update cut off some of the properties at the end, and increased the $iPropertyCount to 500 (from 300) because of Windows 10 file property count increase. Update: Jun-25-2013 I have tweaked this function again, a small update. Added a new parameter to the function, $iPropertyCount, with a default setting of 300. This parameter was previously hard coded inside the function, now you are able to adjust it to the setting you desire/require. This value is used to determine how many file properties will be searched for the value passed in $FGP_PROPERTY, or the maximum amount of properties that will be returned in the array if $FGP_PROPERTY is a blank string. The $FGP_PROPERTY parameter will now accept the Default keyword in place of a blank string, which tells the function to return an array of all known properties, up to the setting of $iPropertyCount. Update: Feb-11-2013 I have updated this function again. Now it has a single point of return, except for error exceptions, instead of multiple places that it returned from previously. I've renamed the variables used so that they'll be less chance of a name collision with someone's script. Fixed a small bug that added a blank line to the end of the array returned when getting all properties. Changed the return value on an error from 0 to an empty string. NOTE: This is a repost of a thread I had already posted last year. I went looking for it today to update the code in it, and found that it had disappeared. New code #include <File.au3> ; only used for the example script, not needed for the UDF #include <Array.au3> ; only used for the example script, not needed for the UDF #include <Constants.au3> ; only used for the MsgBox, not needed for the UDF $sFolder = FileSelectFolder("Select a folder to scan", "") $sFolder &= "" $aFiles = _FileListToArray($sFolder, "*.exe") For $I = 1 To $aFiles[0] $aDetails = _FileGetProperty($sFolder & "\" & $aFiles[$I]) ; Returns an array with all properties of the file _ArrayDisplay($aDetails) Next Global $sDetails = _FileGetProperty($sFolder & "\" & $aFiles[$aFiles[0]], "date modified") MsgBox($MB_SYSTEMMODAL, "Date Modified", $sDetails) ;=============================================================================== ; Function Name.....: _FileGetProperty ; Description.......: Returns a property or all properties for a file. ; Version...........: 1.0.2 ; Change Date.......: 05-16-2012 ; AutoIt Version....: 3.2.12.1+ ; Parameter(s)......: $FGP_Path - String containing the file path to return the property from. ; $FGP_PROPERTY - [optional] String containing the name of the property to return. (default = "") ; $iPropertyCount - [optional] The number of properties to search through for $FGP_PROPERTY, or the number of items ; returned in the array if $FGP_PROPERTY is blank. (default = 300) ; Requirements(s)...: None ; Return Value(s)...: Success: Returns a string containing the property value. ; If $FGP_PROPERTY is blank, a two-dimensional array is returned: ; $av_array[0][0] = Number of properties. ; $av_array[1][0] = 1st property name. ; $as_array[1][1] = 1st property value. ; $av_array[n][0] = nth property name. ; $as_array[n][1] = nth property value. ; Failure: Returns an empty string and sets @error to: ; 1 = The folder $FGP_Path does not exist. ; 2 = The property $FGP_PROPERTY does not exist or the array could not be created. ; 3 = Unable to create the "Shell.Application" object $objShell. ; Author(s).........: - Simucal <Simucal@gmail.com> ; - Modified by: Sean Hart <autoit@hartmail.ca> ; - Modified by: teh_hahn <sPiTsHiT@gmx.de> ; - Modified by: BrewManNH ; URL...............: http://www.autoitscript.com/forum/topic/34732-udf-getfileproperty/page__view__findpost__p__557571 ; Note(s)...........: Modified the script that teh_hahn posted at the above link to include the properties that ; Vista and Win 7 include that Windows XP doesn't. Also removed the ReDims for the $av_ret array and ; replaced it with a single ReDim after it has found all the properties, this should speed things up. ; I further updated the code so there's a single point of return except for any errors encountered. ; $iPropertyCount is now a function parameter instead of being hardcoded in the function itself. ;=============================================================================== Func _FileGetProperty($FGP_Path, $FGP_PROPERTY = "", $iPropertyCount = 500) If $FGP_PROPERTY = Default Then $FGP_PROPERTY = "" $FGP_Path = StringRegExpReplace($FGP_Path, '["'']', "") ; strip the quotes, if any from the incoming string If Not FileExists($FGP_Path) Then Return SetError(1, 0, "") ; path not found Local Const $objShell = ObjCreate("Shell.Application") If @error Then Return SetError(3, 0, "") Local Const $FGP_File = StringTrimLeft($FGP_Path, StringInStr($FGP_Path, "\", 0, -1)) Local Const $FGP_Dir = StringTrimRight($FGP_Path, StringLen($FGP_File) + 1) Local Const $objFolder = $objShell.NameSpace($FGP_Dir) Local Const $objFolderItem = $objFolder.Parsename($FGP_File) Local $Return = "", $iError = 0 If $FGP_PROPERTY Then For $I = 0 To $iPropertyCount If $objFolder.GetDetailsOf($objFolder.Items, $I) = $FGP_PROPERTY Then $Return = $objFolder.GetDetailsOf($objFolderItem, $I) EndIf Next If $Return = "" Then $iError = 2 EndIf Else Local $av_ret[$iPropertyCount + 1][2] = [[0]] For $I = 1 To $iPropertyCount If $objFolder.GetDetailsOf($objFolder.Items, $I) Then $av_ret[$I][0] = $objFolder.GetDetailsOf($objFolder.Items, $I - 1) $av_ret[$I][1] = $objFolder.GetDetailsOf($objFolderItem, $I - 1) ;~ $av_ret[0][0] += 1 $av_ret[0][0] = $I EndIf Next ReDim $av_ret[$av_ret[0][0] + 1][2] If Not $av_ret[1][0] Then $iError = 2 $av_ret = $Return Else $Return = $av_ret EndIf EndIf Return SetError($iError, 0, $Return) EndFunc ;==>_FileGetProperty Warning, old code below.
    1 point
  2. Skysnake

    .a3x Demo

    Several questions around the forum get asked repeatedly: How to avoid false-positive Anti-Virus detection? Answered by AutoIt god himself How to make AutoIt software safe from hacking? How to prevent AutoIt software being de-compiled? How to prevent exposure of native AutoIt code? The general answers all go in the direction of (a) can't be done or (b) make it an .a3x script. The Wiki contains a single entry under "compiler directives" and the Help File contains mainly compiler info, with this note Also see this thread. So I thought I would make a little demo to actually show how it works. Here are the 2 scripts. The a3x_demo.zip file contains these 2, plus the compiled .a3x file and the .EXE The body #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_type=a3x #AutoIt3Wrapper_Outfile=a3x_demo.a3x #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: Skysnake Script Function: Demonstates working of a3x Instructions Code as normal Set Compiler option to .a3x as per Help File Compile Note output is (a) .a3x file, (b) now compile wrapper to make .exe file The compiled .a3x is included inside the .exe. To demonstrate, copy .exe to any new location and run. :) #ce ---------------------------------------------------------------------------- ; Script Start #include <MsgBoxConstants.au3> MsgBox($MB_SYSTEMMODAL, "a3x demo", "This message box is called from an a3x pre-compiled script " & @CRLF & "will timeout after 10 seconds or select the OK button.", 10) ; code ends The wrapper #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=a3x_wrapper.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: Skysnake Script Function: Wrapper for .a3x demo the INCLUDE line below forces the .a3x to be included in the new .EXE other option is to use FileIsntall and then run the a3x_demo.a3x as an external file NOTE: required in order are the following steps 1. body .au3 script 2. compile body .au3 as .a3x file, include in wrapper 3. wrapper .au3 script, to become the .exe -> compile as .EXE #ce ---------------------------------------------------------------------------- ; Script Start - #include "a3x_demo.a3x" ; code ends DOWNLOAD: The ax3_demo.zip file EDIT: 2016.07.08 Fixed typos
    1 point
  3. GMib

    HtmLayout DLL UDF !

    I finally managed to run HtmLayout.dll, HtmLayout is a fast, lightweight and embeddable HTML/CSS renderer and layout manager component. Download dll here : http://www.terrainformatica.com/htmlayout/HTMLayoutDLL.zip #include <WinAPI.au3> #include <WindowsConstants.au3> #include <HtmLayout Constants.au3> #include-once Global $aHLelementsfound = 0 Global $HtmLayoutdll = 0 Global $HtmLayoutRef = 0 Global $HandleWindowsAttachEvent = 0 Global $HtmLayoutEvHandler = 0 Global $aHLDOM_error[7] $aHLDOM_error[0] = "function completed successfully" $aHLDOM_error[1] = "invalid HWND" $aHLDOM_error[2] = "invalid HELEMENT" $aHLDOM_error[3] = "attempt to use HELEMENT which is not marked by HTMLayout_UseElement()" $aHLDOM_error[4] = "parameter is invalid, e.g. pointer is null" $aHLDOM_error[5] = "operation failed, e.g. invalid html in HTMLayoutSetElementHtml()" $aHLDOM_error[6] = "Dllcall error" ; #FUNCTION# ==================================================================================================== ; Name...........: _HLStartup ; Description....: Initialize HtmLayout ; Syntax.........: _HLStartup($dll = "HtmLayout.dll") ; Parameters.....: $dll - Path to HtmLayout DLL [Optional] ; ; Return values..: Success - 1 ; Failure - 0 ; Remarks........: ; =============================================================================================================== Func _HLStartup($dll = "HtmLayout.dll") $HtmLayoutRef += 1 If $HtmLayoutRef > 1 Then Return 1 $HtmLayoutdll = DllOpen($dll) If $HtmLayoutdll = -1 Then Return SetError(1, 0, 0) Return 1 EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _HLCreateGui ; Description....: Create HtmLayout Windows ; Syntax.........: _HLCreateGui($ParentGui, $x = 0, $y = 0, $w = 100, $h = 50) ; Parameters.....: $ParentGui - Handle of parent Gui ; $x - [Optional] ; $y - [Optional] ; $w - [Optional] ; $h - [Optional] ; ; Return values..: Success - HTMLayout window handle. ; Failure - 0 ; Remarks........: ; =============================================================================================================== Func _HLCreateGui($ParentGui, $x = 0, $y = 0, $w = 100, $h = 50) $result = DllCall($HtmLayoutdll, "wstr", "HTMLayoutClassNameW") If @error Then Return 0 $ClassName = $result[0] $HtmLayoutHwnd = _WinAPI_CreateWindowEx(0, $ClassName, "", BitOR($WS_CHILD, $WS_VISIBLE, $WS_CLIPCHILDREN), $x, $y, $w, $h, $ParentGui) Return $HtmLayoutHwnd EndFunc ;==>_HLCreateGui ; #FUNCTION# ==================================================================================================== ; Name...........: _HLLoadFile ; Description....: Load HTML file. ; Syntax.........: _HLLoadFile($HLHwnd, $file) ; Parameters.....: $HLHwnd - HTMLayout window handle. ; $file - File name of an HTML file. ; ; Return values..: Success - 1 ; Failure - 0 ; Remarks........: ; =============================================================================================================== Func _HLLoadFile($HLHwnd, $file) $result = DllCall($HtmLayoutdll, "BOOL", "HTMLayoutLoadFile", "HWND", $HLHwnd, "wstr", $file) Return $result[0] EndFunc ;==>_HLLoadFile ; #FUNCTION# ==================================================================================================== ; Name...........: _HLLoadHtml ; Description....: Load HTML from memory. ; Syntax.........: _HLLoadHtml($HLHwnd, $String) ; Parameters.....: $HLHwnd - HTMLayout window handle. ; $String - HTML to load. ; ; Return values..: Success - 1 ; Failure - 0 ; Remarks........: ; =============================================================================================================== Func _HLLoadHtml($HLHwnd, $String) $StringSize = StringLen($String) $result = DllCall($HtmLayoutdll, "BOOL", "HTMLayoutLoadHtml", "HWND", $HLHwnd, "str", $String, "UINT", $StringSize) Return $result[0] EndFunc ;==>_HLLoadHtml ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetRootElement ; Description....: Get root DOM element of HTML document. ; Syntax.........: _HLGetRootElement($HLHwnd) ; Parameters.....: $HLHwnd - HTMLayout window handle. ; ; Return values..: Success - Return root element. ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: Root DOM object is always a 'HTML' element of the document. ; =============================================================================================================== Func _HLGetRootElement($HLHwnd) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetRootElement", "HWND", $HLHwnd, "ptr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetRootElement ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetChildrenCount ; Description....: Get number of child elements. ; Syntax.........: _HLGetChildrenCount($el) ; Parameters.....: $el - DOM element handle which child elements you need to count ; ; Return values..: Success - Return number of child elements ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetChildrenCount($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetChildrenCount", "ptr", $el, "UINT*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetChildrenCount ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetNthChild ; Description....: Get handle of Nth child element. ; Syntax.........: _HLGetNthChild($el, $nth) ; Parameters.....: $el - DOM element handle ; $nth - number of the child element ; ; Return values..: Success - Return handle of the child element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetNthChild($el, $nth) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetNthChild", "ptr", $el, "UINT", $nth-1, "ptr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[3] EndFunc ;==>_HLGetNthChild ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetParentElement ; Description....: Get parent element. ; Syntax.........: _HLGetParentElement($el) ; Parameters.....: $el - DOM element handle which parent you need ; ; Return values..: Success - Return handle of the parent element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetParentElement($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetParentElement", "ptr", $el, "ptr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetParentElement ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetElementHtml ; Description....: Get Html of the element. ; Syntax.........: _HLGetElementHtml($el, $outer = 1) ; Parameters.....: $el - DOM element handle ; $outer - BOOL, if TRUE will return outer HTML otherwise inner. [Optional] ; ; Return values..: Success - Return Html of element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetElementHtml($el, $outer = 1) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetElementHtml", "ptr", $el, "str*", "", "BOOL", $outer) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetElementHtml ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetElementInnerText ; Description....: Get inner text of the element. ; Syntax.........: _HLGetElementInnerText($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return innertext of element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetElementInnerText($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetElementInnerText", "ptr", $el, "str*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetElementInnerText ; #FUNCTION# ==================================================================================================== ; Name...........: _HLSetElementInnerText ; Description....: Set inner text of the element. ; Syntax.........: _HLSetElementInnerText($el, $String) ; Parameters.....: $el - DOM element handle ; $String - Innertext ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLSetElementInnerText($el, $String) $len = StringLen($String) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutSetElementInnerText", "ptr", $el, "str", $String, "UINT", $len) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return 1 EndFunc ;==>_HLSetElementInnerText ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetAttributeCount ; Description....: Get number of element's attributes. ; Syntax.........: _HLGetAttributeCount($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return number of element attributes. ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetAttributeCount($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetAttributeCount", "ptr", $el, "UINT*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetAttributeCount ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetNthAttribute ; Description....: Get value of any element's attribute by attribute's number. ; Syntax.........: _HLGetNthAttribute($el, $nth) ; Parameters.....: $el - DOM element handle ; $nth - number of desired attribute ; ; Return values..: Success - Return Array with name and value of attribute. $return[0] = name, $return[1] = value ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetNthAttribute($el, $nth) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetNthAttribute", "ptr", $el, "UINT", $nth, "str*", "", "wstr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Dim $aRet[2] $aRet[0] = $result[3] $aRet[1] = $result[4] Return $aRet EndFunc ;==>_HLGetNthAttribute ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetAttributeByName ; Description....: Get value of any element's attribute by name. ; Syntax.........: _HLGetAttributeByName($el, $AttName) ; Parameters.....: $el - DOM element handle ; $AttName - attribute name ; ; Return values..: Success - Return attribute value ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetAttributeByName($el, $AttName) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetAttributeByName", "ptr", $el, "str", $AttName, "wstr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[3] EndFunc ;==>_HLGetAttributeByName ; #FUNCTION# ==================================================================================================== ; Name...........: _HLSetAttributeByName ; Description....: Set attribute's value. ; Syntax.........: _HLSetAttributeByName($el, $AttName, $value) ; Parameters.....: $el - DOM element handle ; $AttName - attribute name ; $value - new attribute value or 0 if you want to remove attribute. ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLSetAttributeByName($el, $AttName, $value) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutSetAttributeByName", "ptr", $el, "str", $AttName, "wstr", $value) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return 1 EndFunc ;==>_HLSetAttributeByName ; #FUNCTION# ==================================================================================================== ; Name...........: _HLClearAttributes ; Description....: Remove all attributes from the element. ; Syntax.........: _HLClearAttributes($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLClearAttributes($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutClearAttributes", "ptr", $el) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return 1 EndFunc ;==>_HLClearAttributes ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetElementIndex ; Description....: Get element index. ; Syntax.........: _HLGetElementIndex($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return index of element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetElementIndex($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetElementIndex", "ptr", $el, "UINT*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetElementIndex ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetElementType ; Description....: Get element's type. ; Syntax.........: _HLGetElementType($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return Type of element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetElementType($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetElementType", "ptr", $el, "str*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetElementType ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetStyleAttribute ; Description....: Get element's style attribute. ; Syntax.........: _HLGetStyleAttribute($el, $StyleName) ; Parameters.....: $el - DOM element handle ; $StyleName - name of the style attribute ; ; Return values..: Success - Return value of the style attribute. ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetStyleAttribute($el, $StyleName) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetStyleAttribute", "ptr", $el, "wstr", $StyleName, "wstr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[3] EndFunc ;==>_HLGetStyleAttribute ; #FUNCTION# ==================================================================================================== ; Name...........: _HLSetStyleAttribute ; Description....: Set element's style attribute. ; Syntax.........: _HLSetStyleAttribute($el, $StyleName, $StyleValue) ; Parameters.....: $el - DOM element handle ; $StyleName - name of the style attribute ; $StyleValue - value of the style attribute. ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLSetStyleAttribute($el, $StyleName, $StyleValue) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutSetStyleAttribute", "ptr", $el, "str", $StyleName, "wstr", $StyleValue) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return 1 EndFunc ;==>_HLSetStyleAttribute ; #FUNCTION# ==================================================================================================== ; Name...........: _HLVisitElements ; Description....: Return Array of elements in a DOM that meets specified criteria. ; Syntax.........: _HLVisitElements($el, $TagName = "", $AttributeName = "", $AttributeValue = "", $depth = 0) ; Parameters.....: $el - DOM element handle ; $TagName - comma separated list of tag names to search, e.g. "div", "p", "div,p" etc. [Optional] ; $AttributeName - name of attribute, can contain wildcard characters. [Optional] ; $AttributeValue - value of attribute, can contain wildcard characters.[Optional] ; $depth - 0 means all descendants, 1 - direct children only, 2 - children and their children and so on. [Optional] ; ; Return values..: Success - Return array of element, $return[0] : number of element. ; Failure - Return 0 if no element found else Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLVisitElements($el, $TagName = "", $AttributeName = "", $AttributeValue = "", $depth = 0) $TagType = "str" $AttType = "str" $AttVType = "wstr" If $TagName = "" Then $TagType = "ptr" If $AttributeName = "" Then $AttType = "ptr" If $AttributeValue = "" Then $AttVType = "ptr" $handle = DllCallbackRegister("_HLElementsCallback", "BOOL", "ptr;ptr") Dim $aHLelementsfound[1] $result = DllCall($HtmLayoutdll, "int", "HTMLayoutVisitElements", "ptr", $el, $TagType, $TagName, $AttType, $AttributeName, $AttVType, $AttributeValue, "ptr", DllCallbackGetPtr($handle), "ptr", "", "DWORD", $depth) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) DllCallbackFree($handle) $HLelementsCount = UBound($aHLelementsfound) If $HLelementsCount = 1 Then Return 0 $aHLelementsfound[0] = $HLelementsCount-1 Return $aHLelementsfound EndFunc ;==>_HLVisitElements Func _HLElementsCallback($el, $param) Local $iUBound = UBound($aHLelementsfound) ReDim $aHLelementsfound[$iUBound + 1] $aHLelementsfound[$iUBound] = $el EndFunc ;==>_HLElementsCallback ; #FUNCTION# ==================================================================================================== ; Name...........: _HLSelectElements ; Description....: Return Array of elements in a DOM that meets specified CSS selectors. ; Syntax.........: _HLSelectElements($el, $CssSel) ; Parameters.....: $el - DOM element handle ; $CssSel - comma separated list of CSS selectors, e.g.: div, id, div[align="right"]. ; ; Return values..: Success - Return Array of elements, $return[0] : number of element. ; Failure - Return 0 if no element found else Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: See list of supported selectors: http://terrainformatica.com/htmlayout/selectors.whtm ; =============================================================================================================== Func _HLSelectElements($el, $CssSel) $handle = DllCallbackRegister("_HLElementsCallback", "BOOL", "ptr;ptr") Dim $aHLelementsfound[1] $result = DllCall($HtmLayoutdll, "int", "HTMLayoutSelectElements", "ptr", $el, "str", $CssSel, "ptr", DllCallbackGetPtr($handle), "ptr", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) DllCallbackFree($handle) $HLelementsCount = UBound($aHLelementsfound) If $HLelementsCount = 1 Then Return 0 $aHLelementsfound[0] = $HLelementsCount-1 Return $aHLelementsfound EndFunc ;==>_HLSelectElements ; #FUNCTION# ==================================================================================================== ; Name...........: _HLSelectParent ; Description....: Find parent of the element by CSS selector. ; Syntax.........: _HLSelectParent($el, $CssSel, $depth = 0) ; Parameters.....: $el - DOM element handle ; $CssSel - comma separated list of CSS selectors, e.g.: div, id, div[align="right"]. ; $depth - if depth == 1 then it will test only element itself. ; Use depth = 1 if you just want to test he element for matching given CSS selector(s). ; depth = 0 will scan the whole child parent chain up to the root. [Optional] ; ; Return values..: Success - Return parent of the element. ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLSelectParent($el, $CssSel, $depth = 0) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutSelectParent", "ptr", $el, "str", $CssSel, "UINT", $depth, "ptr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[4] EndFunc ;==>_HLSelectParent ; #FUNCTION# ==================================================================================================== ; Name...........: _HLSetElementHtml ; Description....: Set inner or outer html of the element. ; Syntax.........: _HLSetElementHtml($el, $html, $where) ; Parameters.....: $el - DOM element handle ; $html - string containing html text ; $where - possible values are: ; 0: replace content of the element ; 1: insert html before first child of the element ; 2: insert html after last child of the element ; 3: replace element by html, a.k.a. element.outerHtml = "something" ; 4: insert html before the element ; 5: insert html after the element ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: Value 3,4 and 5 for $where do not work for inline elements like ; =============================================================================================================== Func _HLSetElementHtml($el, $html, $where) $htmllen = StringLen($html) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutSetElementHtml", "ptr", $el, "str", $html, "DWORD", $htmllen, "UINT", $where) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return 1 EndFunc ;==>_HLSetElementHtml ; #FUNCTION# ==================================================================================================== ; Name...........: _HLDeleteElement ; Description....: Delete element. ; Syntax.........: _HLDeleteElement($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: After call to this function $el will become invalid. ; =============================================================================================================== Func _HLDeleteElement($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutDeleteElement", "ptr", $el) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return 1 EndFunc ;==>_HLDeleteElement ;~ EXTERN_C HLDOM_RESULT HLAPI HTMLayoutShowPopup (HELEMENT hePopup, HELEMENT heAnchor, UINT placement) ;~ Shows block element (DIV) in popup window. ;~ Func _HLShowPopup($HtmLayoutdll, $el, $anchor, $placement) ;~ $result = DllCall($HtmLayoutdll, "int", "HTMLayoutShowPopup", "ptr", $el, "ptr", $anchor, "UINT", $placement) ;~ If @error Then Return 0 ;~ Return 1 ;~ EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _HLWindowAttachEventHandler ; Description....: Attach/Detach ElementEventProc to the htmlayout window. ; Syntax.........: _HLWindowAttachEventHandler($hwnd, $func) ; Parameters.....: $hwnd - HWND of HtmLayout windows ; $func - Function to receive events (need two params eg: $func($ev, $prm) ; $events - Events you want receive (see remarks) ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: _HLGetParam must use for read param of event. ;~ Events can be : ;~ $HANDLE_INITIALIZATION : attached/detached ;~ $HANDLE_MOUSE : mouse events ;~ $HANDLE_KEY : key events ;~ $HANDLE_FOCUS : focus events, if this flag is set it also means that element it attached to is focusable ;~ $HANDLE_SCROLL : scroll events ;~ $HANDLE_SIZE : size changed event ;~ $HANDLE_DATA_ARRIVED : requested data () has been delivered ;~ $HANDLE_BEHAVIOR_EVENT : secondary, synthetic events: ;~ BUTTON_CLICK, HYPERLINK_CLICK, etc., ;~ a.k.a. notifications from intrinsic behaviors ;~ $HANDLE_METHOD_CALL : behavior specific methods ;~ $HANDLE_EXCHANGE : system drag-n-drop events ;~ $HANDLE_ALL : all of them ; =============================================================================================================== Func _HLWindowAttachEventHandler($hwnd, $func, $events) $HandleWindowsAttachEvent = DllCallbackRegister("HLEvHandler", "BOOL", "ptr;ptr;UINT;ptr") $result = DllCall($HtmLayoutdll, "int", "HTMLayoutWindowAttachEventHandler", "HWND", $hwnd, "ptr", DllCallbackGetPtr($HandleWindowsAttachEvent), "ptr", "", "UINT", $DISABLE_INITIALIZATION+$events) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) $HtmLayoutEvHandler = $func Return 1 EndFunc ;==>_HLWindowAttachEventHandler Func HLEvHandler($tag,$el,$ev,$prm) $a = DllStructCreate("UINT cmd", $prm) $cmd = DllStructGetData($a, "cmd") $a = 0 If $cmd > 32768 Then Return Execute ($HtmLayoutEvHandler&"("&$ev&","&$prm&")") EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetParam ; Description....: Get parameter of events ; Syntax.........: _HLGetParam($ev, $prm) ; Parameters.....: $ev - Type of event see remarks of _HLWindowAttachEventHandler ; $prm - Parameter of event ; ; Return values..: Success - return an array depending of event ; Failure - Return -1 ; Remarks........: For Uppercase type see "HtmLayout Constants.au3" ; $HANDLE_MOUSE : $ret[12]=[MOUSE_EVENTS, target el, curs xpos el rel, curs ypos el rel, curs xpos doc rel, curs ypos doc rel, MOUSE_BUTTONS, KEYBOARD_STATES, CURSOR_TYPE, is on icon, el dragged, DRAGGING_TYPE] ; $HANDLE_KEY : $ret[4]=[KEY_EVENTS, target el, key code, KEYBOARD_STATES] ; $HANDLE_FOCUS : $ret[4]=[FOCUS_EVENTS, target el, focus by click, cancel] ; $HANDLE_SCROLL: $ret[4]=[SCROLL_EVENTS, target el, scroll pos, 1 if vert scroll] ; $HANDLE_BEHAVIOR_EVENT : $ret[5]=[BEHAVIOR_EVENTS, target el, source el, EVENT_REASON or EDIT_CHANGED_REASON, data] ;=============================================================================================================== Func _HLGetParam($ev, $prm) Local $ap = -1 If $ev = $HANDLE_MOUSE Then $str = "UINT cmd;ptr target;DWORD posx;DWORD posy;DWORD pos_documentx;DWORD pos_documenty;UINT button_state;UINT alt_state;UINT cursor_type;BOOL is_on_icon;ptr dragging;UINT dragging_mode" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_KEY Then $str = "UINT cmd;ptr target;UINT key_code;UINT alt_state" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_FOCUS Then $str = "UINT cmd;ptr target;BOOL by_mouse_click;BOOL cancel" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_SCROLL Then $str = "UINT cmd;ptr target;int pos;BOOL vertical" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_BEHAVIOR_EVENT Then $str = "UINT cmd;ptr heTarget;ptr he;UINT reason;ptr data" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_METHOD_CALL Then $str = "UINT cmd;ptr heTarget;ptr he;UINT reason;ptr data" $ap = getstructdata($str,$prm) EndIf Return $ap EndFunc Func getstructdata($str,$prm) $a = DllStructCreate($str, $prm) $b = StringSplit ( $str, ";") Dim $ret[$b[0]] For $i = 0 To $b[0]-1 $ret[$i] = DllStructGetData($a,$i+1) Next Return $ret EndFunc Edit: add some function. User calltips : _HLStartup ($dll = "HtmLayout.dll") Initialize HtmLayout (required: #include <HtmLayout UDF.au3>) _HLCreateGui ($ParentGui, $x = 0, $y = 0, $w = 100, $h = 50) Create HtmLayout Windows (required: #include <HtmLayout UDF.au3>) _HLLoadFile ($HLHwnd, $file) Load HTML file. (required: #include <HtmLayout UDF.au3>) _HLLoadHtml ($HLHwnd, $String) Load HTML from memory. (required: #include <HtmLayout UDF.au3>) _HLGetRootElement ($HLHwnd) Get root DOM element of HTML document. (required: #include <HtmLayout UDF.au3>) _HLGetChildrenCount ($el) Get number of child elements. (required: #include <HtmLayout UDF.au3>) _HLGetGetFocusElement ($hwnd) Get focused DOM element of HTML document. (required: #include <HtmLayout UDF.au3>) _HLGetGetElementState ($el) Get state bits, see ELEMENT_STATE_BITS in "HtmLayout constats.au3" (required: #include <HtmLayout UDF.au3>) _HLSetElementState ($el, $stateToSet, $stateToClear = 0, $upt = 1) Set state bits, see ELEMENT_STATE_BITS in "HtmLayout constats.au3" (required: #include <HtmLayout UDF.au3>) _HLGetNthChild ($el, $nth) Get handle of Nth child element. (required: #include <HtmLayout UDF.au3>) _HLGetParentElement ($el) Get parent element. (required: #include <HtmLayout UDF.au3>) _HLGetElementHtml ($el, $outer = 1) Get Html of the element. (required: #include <HtmLayout UDF.au3>) _HLGetElementInnerText ($el) Get inner text of the element. (required: #include <HtmLayout UDF.au3>) _HLSetElementInnerText ($el, $String) Set inner text of the element. (required: #include <HtmLayout UDF.au3>) _HLGetAttributeCount ($el) Get number of element's attributes. (required: #include <HtmLayout UDF.au3>) _HLGetNthAttribute ($el, $nth) Get value of any element's attribute by attribute's number. (required: #include <HtmLayout UDF.au3>) _HLGetAttributeByName ($el, $AttName) Get value of any element's attribute by name. (required: #include <HtmLayout UDF.au3>) _HLSetAttributeByName ($el, $AttName, $value) Set attribute's value. (required: #include <HtmLayout UDF.au3>) _HLClearAttributes ($el) Remove all attributes from the element. (required: #include <HtmLayout UDF.au3>) _HLGetElementIndex ($el) Get element index. (required: #include <HtmLayout UDF.au3>) _HLGetElementType ($el) Get element's type. (required: #include <HtmLayout UDF.au3>) _HLGetStyleAttribute ($el, $StyleName) Get element's style attribute. (required: #include <HtmLayout UDF.au3>) _HLSetStyleAttribute ($el, $StyleName, $StyleValue) Set element's style attribute. (required: #include <HtmLayout UDF.au3>) _HLVisitElements ($el, $TagName = "", $AttributeName = "", $AttributeValue = "", $depth = 0) Return Array of elements in a DOM that meets specified criteria. (required: #include <HtmLayout UDF.au3>) _HLSelectElements ($el, $CssSel) Return Array of elements in a DOM that meets specified CSS selectors. (required: #include <HtmLayout UDF.au3>) _HLSelectParent ($el, $CssSel, $depth = 0) Find parent of the element by CSS selector. (required: #include <HtmLayout UDF.au3>) _HLSetElementHtml ($el, $html, $where) Set inner or outer html of the element. (required: #include <HtmLayout UDF.au3>) _HLDeleteElement ($el) Delete element. (required: #include <HtmLayout UDF.au3>) _HLWindowAttachEventHandler ($hwnd, $func) Attach/Detach ElementEventProc to the htmlayout window. (required: #include <HtmLayout UDF.au3>) _HLGetParam ($ev, $prm) Get parameter of events (required: #include <HtmLayout UDF.au3>)HtmLayout UDF.7z
    1 point
  4. water

    Getting Date from file

    Something like this: or, even newer, this:
    1 point
  5. nend

    .a3x Demo

    I've tryed it because I has a program made in Autoit wich is use by a lot of people and I get a lot "False Positive". It takes with every update about 3 weeks to report it to al virusscan company, because a lot of them reply very slow on these reports. What I've discovered is that a lot of scanners stil mark it as virus when I use a3x file packed in a exe file but it are less then usally. But I think it's a matter of time before viruscan company marks this way as virus as well. Thanks for showing how to do this.
    1 point
  6. Skysnake

    .a3x Demo

    Dear @argumentum I am not sure how to interpret your response. This little demo was so supposed to show exactly how an .au3 file becomes an .a3x file and gets included in an .EXE. AFAIK this is the only complete example in the Forum. Thank you for reading.
    1 point
  7. edited above as you posted: looks like your run command has a double set of "" at the end, but only one at the beginning.
    1 point
  8. You have double, double quotes on the end of your run command. The error message is telling you just what is wrong.
    1 point
  9. Many #32770 windows exist in the background, so you might check first which one is visible #include <Array.au3>; for _ArrayDisplay $aWinList = WinList("[CLASS:#32770]") ;_ArrayDisplay($aWinList) Local $handle For $i = 1 to $aWinList[0][0] If BitAND(WinGetState($aWinList[$i][1]), 2) Then ; is the window visible ? $handle = $aWinList[$i][1] Exitloop EndIf Next $iItemCount = ControlListView($handle, "", "[Class:SysListView32; INSTANCE:1]", "GetItemCount") Msgbox(0,"", $iItemCount) ; etc
    1 point
  10. #include <Array.au3>; for _ArrayDisplay $aWinList = WinList("[CLASS:#32770]") _ArrayDisplay($aWinList) For $i = 1 to $aWinList[0][0] ;If $aWinList[$i][0] = "" Then $iItemCount = ControlListView($aWinList[$i][1], "", "[Class:SysListView32]", "GetItemCount") ConsoleWrite($iItemCount & @CRLF) ;EndIf Next
    1 point
  11. That would be because you didn't surround the parameter in quotes. Should be "[CLASS:#32770]"
    1 point
  12. Not starting a discussion on this but: hitting F1 and typing the search word I gave and then reading the page on COM can't be too difficult to preform or else one should seriously reconsider coding all together. In other words: It doesn't hurt to put in some effort. Jos
    1 point
  13. Thre screenshot from post #11 shows that the window does not have a title ("Basic Window Info"). So it seems you need to use the Class: Global $iItemCount = ControlListView([CLASS:#32770], "", "[Class:SysListView32]", "GetItemCount")
    1 point
  14. it's just a sample u need adapt it for u. u can probably look around winlist, etc... anyway @water suggest are good, give us a screenshot with
    1 point
  15. trancexx

    How this a3x works?

    It's magic. Compiled that way it can't be decompiled. It uses hidden AutoIt feature known only to two, maybe three people in the whole world. This guy has found the way to stop decompilation forever. Not. Nah, I'm kidding. That's not a3x, that's simple au3 with 22Mb of comments and what, 1000 lines of au3 code obfuscated using apparently well known (fuck knows why) obfuscator. ...Don't say you didn't buy this.
    1 point
×
×
  • Create New...