Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/26/2020 in all areas

  1. Introduction JSON (Javascript Object Notation) is a popular data-interchange format and supported by a lot of script languages. On AutoIt, there is already a >JSON UDF written by Gabriel Boehme. It is good but too slow, and not supports unicode and control characters very well. So I write a new one (and of course, fast one as usual). I use a machine code version of JSON parser called "jsmn". jsmn not only supports standard JSON, but also accepts some non-strict JSON string. See below for example. Important Update!! I rename the library from jsmn.au3 to json.au3. All function names are changed, too. Decoding Function Json_Decode($Json) $Json can be a standard or non-standard JSON string. For example, it accepts: { server: example.com port: 80 message: "this looks like a config file" } The most JSON data type will be decoded into corresponding AutoIt variable, including 1D array, string, number, true, false, and null. JSON object will be decoded into "Windows Scripting Dictionary Object" retuned from ObjCreate("Scripting.Dictionary"). AutoIt build-in functions like IsArray, IsBool, etc. can be used to check the returned data type. But for Object and Null, Json_IsObject() and Json_IsNull() should be used. If the input JSON string is invalid, @Error will be set to $JSMN_ERROR_INVAL. And if the input JSON string is not finish (maybe read from stream?), @Error will be set to $JSMN_ERROR_PART. Encoding Function Json_Encode($Data, $Option = 0, $Indent = "\t", $ArraySep = ",\r\n", $ObjectSep = ",\r\n", $ColonSep = ": ") $Data can be a string, number, bool, keyword(default or null), 1D arrry, or "Scripting.Dictionary" COM object. Ptr will be converted to number, Binary will be converted to string in UTF8 encoding. Other unsupported types like 2D array, dllstruct or object will be encoded into null. $Option is bitmask consisting following constant: $JSON_UNESCAPED_ASCII ; Don't escape ascii charcters between chr(1) ~ chr(0x1f) $JSON_UNESCAPED_UNICODE ; Encode multibyte Unicode characters literally $JSON_UNESCAPED_SLASHES ; Don't escape / $JSON_HEX_TAG ; All < and > are converted to \u003C and \u003E $JSON_HEX_AMP ; All &amp;amp;amp;amp;s are converted to \u0026 $JSON_HEX_APOS ; All ' are converted to \u0027 $JSON_HEX_QUOT ; All " are converted to \u0022 $JSON_PRETTY_PRINT ; Use whitespace in returned data to format it $JSON_STRICT_PRINT ; Make sure returned JSON string is RFC4627 compliant $JSON_UNQUOTED_STRING ; Output unquoted string if possible (conflicting with $JSMN_STRICT_PRINT) Most encoding option have the same means like PHP's json_enocde() function. When $JSON_PRETTY_PRINT is set, output format can be change by other 4 parameters ($Indent, $ArraySep, $ObjectSep, and $ColonSep). Because these 4 output format parameters will be checked inside Jsmn_Encode() function, returned string will be always accepted by Jsmn_Decode(). $JSON_UNQUOTED_STRING can be used to output unquoted string that also accetped by Jsmn_Decode(). $JSON_STRICT_PRINT is used to check output format setting and avoid non-standard JSON output. So this option is conflicting with $JSON_UNQUOTED_STRING. Get and Put Functions Json_Put(ByRef $Var, $Notation, $Data, $CheckExists = False) Json_Get(ByRef $Var, $Notation) These functions helps user to access object or array more easily. Both dot notation and square bracket notation can be supported. Json_Put() by default will create non-exists objects and arrays. For example: Local $Obj Json_Put($Obj, ".foo", "foo") Json_Put($Obj, ".bar[0]", "bar") Json_Put($Obj, ".test[1].foo.bar[2].foo.bar", "Test") Local $Test = Json_Get($Obj, '["test"][1]["foo"]["bar"][2]["foo"]["bar"]') ; "Test" Object Help Functions Json_ObjCreate() Json_ObjPut(ByRef $Object, $Key, $Value) Json_ObjGet(ByRef $Object, $Key) Json_ObjDelete(ByRef $Object, $Key) Json_ObjExists(ByRef $Object, $Key) Json_ObjGetCount(ByRef $Object) Json_ObjGetKeys(ByRef $Object) Json_ObjClear(ByRef $Object) These functions are just warps of "Scripting.Dictionary" COM object. You can use these functions if you are not already familiar with it. == Update 2013/05/19 == * Add Jsmn_Encode() option "$JSMN_UNESCAPED_ASCII". Now the default output of Json_Encode() is exactly the same as PHP's json_encode() function (for example, chr(1) will be encoded into u0001). $JSON_UNESCAPED_ASCII ; Don't escape ascii charcters between chr(1) ~ chr(0x1f) == Update 2015/01/08 == * Rename the library from jsmn.au3 to json.au3. All function names are changed, too. * Add Json_Put() and Json_Get() * Add Null support * Using BinaryCall.au3 to loading the machine code. == Update 2018/01/13== (Jos) * Add JsonDump() to list all Json Keys and their values to easily figure out what they are. == Update 2018/10/01== (Jos) * Fixed JsonDump() some fields and values were not showing as discussed here - tnx @TheXman . == Update 2018/10/01b== (Jos) * Added Json_ObjGetItems, Tidied source and fixed au3check warnings - tnx @TheXman . == Update 2018/10/28== (Jos) * Added declaration for $value to avoid au3check warning - tnx @DerPensionist == Update 2018/12/16== (Jos) * Added another declaration for $value to avoid au3check warning and updated the version at the top - tnx @maniootek == Update 2018/12/29== (Jos) * Changed Json_ObjGet() and Json_ObjExists() to allow for multilevel object in string. == Update 2019/01/17== (Jos) * Added support for DOT notation in JSON functions. == Update 2019/07/15== (Jos) * Added support for reading keys with a dot inside when using a dot as separator (updated) == Update 2021/11/18== (TheXman) * Update details in below post: == Update 2021/11/20== (TheXman) * Minor RegEx update, no change to the functionality or result._Json(2021.11.20).zip
    1 point
  2. LarsJ

    UI Automation UDFs

    To make it easier to maintain the UIA code, I've decided to split the code this way: This new thread is used for the actual UIA UDFs. Ie. the files stored in Includes folders and named UIA_*.au3 or UIAEH_*.au3. The UIASpy thread contains only code that is used directly in the UIASpy GUI, but not the UIA UDFs in this new thread. Using UIA Code contains only example code, but neither UIA UDFs nor UIASpy. UIA Events contains GUI code to detect events and it contains example code, but neither UIA UDFs nor UIASpy. This means that every time the code in the UDF files in this new thread is updated (eg. because of Windows 10 feature updates twice a year), you must install the files in the Includes folders in the other threads yourself. The easiest way is simply to copy all UDF files to the Includes folders. UDF Files CUIAutomation2.au3 - UIA constants for Windows 7 used in the first examples CUIAutomation2-a.au3 - The original UIA constants for Windows 7 from junkew's thread UIA_AccVars.au3 - Used to calculate properties of type VT_UNKNOWN, copied and modified from this thread UIA_Constants.au3 - UIA constants (copied from UIA header files) up to and including Windows 10 1809 UIA_ConstNames.au3 - Contains functions for converting UIA constants from values to names UIA_Functions.au3 - A collection of small utility functions UIA_Functions-a.au3 - First version of utility functions UIA_ObjectFromTag.au3 - Creates callback objects used in event handlers, copied and modified from this post by trancexx UIA_SafeArray.au3 - Constants and functions to handle safearrays, copied from this thread UIA_Variant.au3 - Constants and functions to handle variants, copied from this thread UIAEH_AutomationEventHandler.au3 - Implements the AutomationEventHandler UIAEH_FocusChangedEventHandler.au3 - Implements the FocusChangedEventHandler UIAEH_NotificationEventHandler.au3 - Implements the NotificationEventHandler, published in Windows 10 1709 UIAEH_PropertyChangedEventHandler.au3 - Implements the PropertyChangedEventHandler UIAEH_StructureChangedEventHandler.au3 - Implements the StructureChangedEventHandler Folders The UI Automation projects can be stored in a folder structure this way: UI Automation\ Code\ - Using UIA code Events\ - UIA events Spy tool\ - UIASpy.au3 UDFs\ - UDF files The UDF files must be installed in Includes\ in the first three folders. Threads UIASpy - UI Automation Spy Tool is a GUI tool that provides information about windows and controls and their interconnection and provides functionality to generate sample code. UIASpy is essential for creating UI Automation code. In Using UI Automation Code in AutoIt you can find and download examples and read information about using UIA code. UI Automation Events is about implementing event handlers and includes GUIs to detect events. IUIAutomation MS framework automate chrome, FF, IE, .... created by junkew August 2013 is the first AutoIt thread on UIA code. Zip-file The zip contains source code for the UDF files. You need AutoIt 3.3.12 or later. Tested on Windows XP, Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. UIAIncludes.7z
    1 point
  3. Look at StringToASCIIArray() and StringFormat(). Local $s = "8cdb3" ; any non-empty Unicode string Local $a = StringToASCIIArray($s) Local $sOut = StringFormat("%03i", $a[0]) For $i = 1 To UBound($a) - 1 $sOut &= StringFormat(" %03i", $a[$i]) Next ConsoleWrite($sOut & @LF)
    1 point
  4. well, with autoit you can use the RichText control for such things. here is an example: Or you can do, if you do not mind embedding internet explorer pages, well (less or more) everything that html can do. Here is an example:
    1 point
  5. @hemal Yes, you should be able to call _WD_ElementAction with the Enabled command to test if an element is enabled or disabled. Give it a shot and then let us know your outcome.
    1 point
  6. @Musashi It is true that I always try to avoid downloading stuff if I can easily use built-in functionality (old fashion way). So to give OP a perspective of choices, here the unzip function that I use : #include <Constants.au3> #include <String.au3> Opt("MustDeclareVars", 1) Const $sZipFile = @ScriptDir & "\Test.zip" Const $sFolder = @ScriptDir & "\Temp" DirRemove ($sFolder, $DIR_REMOVE) UnZip($sZipFile, $sFolder) If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error unzipping files : " & @error) Func UnZip($sZipFile, $sDestFolder) If Not FileExists($sZipFile) Then Return SetError (1) ; source file does not exists If Not FileExists($sDestFolder) Then If Not DirCreate($sDestFolder) Then Return SetError (2) ; unable to create destination Else If Not StringInStr(FileGetAttrib($sDestFolder), "D") Then Return SetError (3) ; destination not folder EndIf Local $oShell = ObjCreate("shell.application") Local $oZip = $oShell.NameSpace($sZipFile) Local $iZipFileCount = $oZip.items.Count If Not $iZipFileCount Then Return SetError (4) ; zip file empty For $oFile In $oZip.items $oShell.NameSpace($sDestFolder).copyhere($ofile) Next EndFunc ;==>UnZip
    1 point
  7. UEZ

    PNG button image

    You can do something like this here: #include <ButtonConstants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <SendMessage.au3> #include <GuiImageList.au3> #include <GuiTab.au3> Opt("GUIOnEventMode", 1) _GDIPlus_Startup() $xGui = GUICreate("", 412, 360, -1, -1) $xTab = GUICtrlCreateTab(5, 5, 412 - 10, 328 - 10) $xButton = GUICtrlCreateButton("Test", 100, 100, 150, 50) ;Global Const $STM_SETIMAGE = 0x0172, $BM_SETIMAGE = 0xF7, $IMAGE_BITMAP = 0 Global Const $hHBitmap = _GDIPlus_BitmapCreateFromMemory(_ico_Test01(), True) Global Const $hBitmap1 = _GDIPlus_BitmapCreateFromMemory(_ico_Test01()) Global Const $hBitmap2 = _GDIPlus_BitmapCreateFromMemory(_ico_Test02()) Global $hImg = _GDIPlus_ImageResize($hBitmap1, 16, 16) $hHBitmap1 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _GDIPlus_ImageDispose($hImg) Global $hImg = _GDIPlus_ImageResize($hBitmap2, 16, 16) $hHBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _GDIPlus_ImageDispose($hImg) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($xButton), 0xF7, 0, $hHBitmap)) _GUICtrlTab_InsertItem($xTab, 0, "TabItem 1") _GUICtrlTab_InsertItem($xTab, 1, "TabItem 2") Global $hIL = _GUIImageList_Create(16, 15, 5) DllCall("comctl32.dll", "int", "ImageList_Add", "handle", $hIL, "handle", $hHBitmap1, "handle", 0) DllCall("comctl32.dll", "int", "ImageList_Add", "handle", $hIL, "handle", $hHBitmap2, "handle", 0) _GUICtrlTab_SetImageList($xTab, $hIL) _GUICtrlTab_SetItemImage($xTab, 0, 0) _GUICtrlTab_SetItemImage($xTab, 1, 1) GUISetState() GUISetOnEvent(-3, "_Exit") While 1 Sleep(25) WEnd Func _ico_Test01() Local $ico $ico &= "0000010001002040000001002000A810000016000000280000002000000040000000010020000000000080100000000000000000000000000000000000001168A0181687CFAF1689D2DE1689D2DF1689D2DF1689D2DF1689D2DF1689D2DF1689D2DF1689D2DF1689D2DF1689D2DF1689D2DF1689D2DF1688CFBC1478B5272DA4382736C43EBC36C63EDF36C73EDF36C73EDF36C73EDF36C73EDF36C73EDF36C73EDF36C73EDF36C73EDF36C73EDF36C73EDF36C63EDE36C43EAF2C9F32181689D3AF1590DFFF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1590DFFF178DCFCF35C646CF37D340FF37D440FF37D440FF37D440FF37D440FF37D440FF37D440FF37D440FF37D440FF37D440FF37D440FF37D440FF37D440FF37D340FF36C83FAF158FDDDE1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1591E0FF1590DEFE38D341FE38D541FF38D541FF38D541FF38D541FF38D541FF38D541FF38D541FF38D541FF38D541FF38D541FF38D541FF38D541FF38D541FF38D541FF38D241E11692E1DF1692E1FF1692E1FF1692E1FF1692E1FF1692E1FF1692E1FF1692E1FF1692E1FF1692E1FF1692E1FF1692E1FF1692E1FF1692E1FF1692E1FF1692E1FF3AD5" $ico &= "43FF3AD543FF3AD543FF3AD543FF3AD543FF3AD543FF3AD543FF3AD543FF3AD543FF3AD543FF3AD543FF3AD543FF3AD543FF3AD543FF3AD543FF3AD543E31793E2DF1793E2FF1793E2FF1793E2FF1793E2FF1793E2FF1793E2FF1793E2FF1793E2FF1793E2FF1793E2FF1793E2FF1793E2FF1793E2FF1793E2FF1793E2FF3BD644FF3BD644FF3BD644FF3BD644FF3BD644FF3BD644FF3BD644FF3BD644FF3BD644FF3BD644FF3BD644FF3BD644FF3BD644FF3BD644FF3BD644FF3BD544E31895E4DF1995E4FF1995E4FF1995E4FF1995E4FF1995E4FF1995E4FF1995E4FF1995E4FF1995E4FF1995E4FF1995E4FF1995E4FF1995E4FF1995E4FF1995E4FF3CD645FF3CD645FF3CD645FF3CD645FF3CD645FF3CD645FF3CD645FF3CD645FF3CD645FF3CD645FF3CD645FF3CD645FF3CD645FF3CD645FF3CD645FF3CD645E31A96E5DF1A96E5FF1A96E5FF1A96E5FF1A96E5FF1A96E5FF1A96E5FF1A96E5FF1A96E5FF1A96E5FF1A96E5FF1A96E5FF1A96E5FF1A96E5FF1A96E5FF1A96E5FF3DD747FF3DD747FF3DD747FF3DD747FF3DD747FF3DD747FF3DD747FF3DD747FF3DD747FF3DD747FF3DD747FF3DD747FF3DD747FF3DD747FF3DD747FF3DD747E31B98E7DF1B98E7FF1B98E7FF1B98E7FF1B98E7FF1B98E7FF1B98E7FF1B98E7FF1B98E7FF1B98E7FF1B98E7FF1B98E7FF1B98E7FF1B98E7FF1B98E7FF1B98E7FF3FD8" $ico &= "48FF3FD848FF3FD848FF3FD848FF3FD848FF3FD848FF3FD848FF3FD848FF3FD848FF3FD848FF3FD848FF3FD848FF3FD848FF3FD848FF3FD848FF3ED748E31D99E8DF1D99E8FF1D99E8FF1D99E8FF1D99E8FF1D99E8FF1D99E8FF1D99E8FF1D99E8FF1D99E8FF1D99E8FF1D99E8FF1D99E8FF1D99E8FF1D99E8FF1D99E8FF40D849FF40D849FF40D849FF40D849FF40D849FF40D849FF40D849FF40D849FF40D849FF40D849FF40D849FF40D849FF40D849FF40D849FF40D849FF40D849E31E9BEADF1E9BEAFF1E9BEAFF1E9BEAFF1E9BEAFF1E9BEAFF1E9BEAFF1E9BEAFF1E9BEAFF1E9BEAFF1E9BEAFF1E9BEAFF1E9BEAFF1E9BEAFF1E9BEAFF1E9BEAFF41D94AFF41D94AFF41D94AFF41D94AFF41D94AFF41D94AFF41D94AFF41D94AFF41D94AFF41D94AFF41D94AFF41D94AFF41D94AFF41D94AFF41D94AFF41D84AE3209CEBDF209CEBFF209CEBFF209CEBFF209CEBFF209CEBFF209CEBFF209CEBFF209CEBFF209CEBFF209CEBFF209CEBFF209CEBFF209CEBFF209CEBFF209CEBFF42D94CFF42D94CFF42D94CFF42D94CFF42D94CFF42D94CFF42D94CFF42D94CFF42D94CFF42D94CFF42D94CFF42D94CFF42D94CFF42D94CFF42D94CFF42D94CE3219DECDF219EEDFF219EEDFF219EEDFF219EEDFF219EEDFF219EEDFF219EEDFF219EEDFF219EEDFF219EEDFF219EEDFF219EEDFF219EEDFF219EEDFF219EEDFF43DA" $ico &= "4DFF43DA4DFF43DA4DFF43DA4DFF43DA4DFF43DA4DFF43DA4DFF43DA4DFF43DA4DFF43DA4DFF43DA4DFF43DA4DFF43DA4DFF43DA4DFF43DA4DFF43DA4DE3229FEEDF229FEEFF229FEEFF229FEEFF229FEEFF229FEEFF229FEEFF229FEEFF229FEEFF229FEEFF229FEEFF229FEEFF229FEEFF229FEEFF229FEEFF229FEEFF45DB4EFF45DB4EFF45DB4EFF45DB4EFF45DB4EFF45DB4EFF45DB4EFF45DB4EFF45DB4EFF45DB4EFF45DB4EFF45DB4EFF45DB4EFF45DB4EFF45DB4EFF45DA4EE324A0EFDF24A0EFFF24A0EFFF24A0EFFF24A0EFFF24A0EFFF24A0EFFF24A0EFFF24A0EFFF24A0EFFF24A0EFFF24A0EFFF24A0EFFF24A0EFFF24A0EFFF24A0EFFF46DB50FF46DB50FF46DB50FF46DB50FF46DB50FF46DB50FF46DB50FF46DB50FF46DB50FF46DB50FF46DB50FF46DB50FF46DB50FF46DB50FF46DB50FF46DB50E225A2F1BC25A2F1FF25A2F1FF25A2F1FF25A2F1FF25A2F1FF25A2F1FF25A2F1FF25A2F1FF25A2F1FF25A2F1FF25A2F1FF25A2F1FF25A2F1FF25A2F1FF26A4ECDC46D958DC47DC51FF47DC51FF47DC51FF47DC51FF47DC51FF47DC51FF47DC51FF47DC51FF47DC51FF47DC51FF47DC51FF47DC51FF47DC51FF47DC51FF47DB51BC2290D62727A3F2CF27A3F2FE27A3F2FF27A3F2FF27A3F2FF27A3F2FF27A3F2FF27A3F2FF27A3F2FF27A3F2FF27A3F2FF27A3F2FF27A3F2FF34A2E3DF5BA1B33E72C3" $ico &= "4F3E53D750DF48DC52FF48DC52FF48DC52FF48DC52FF48DC52FF48DC52FF48DC52FF48DC52FF48DC52FF48DC52FF48DC52FF48DC52FE48DC52CF42CA4B2700000000000000000000000000000000000000000000000000000000000000008D9E7F30C09D48D5CF9F3BFED09F3BFFD09F3BFFD09F3BFFD09F3BFFD09F3BFFD09F3BFFD09F3BFFD09F3BFFD09F3BFFD09F3BFFCF9F3BFEC3A13CD59BB2433000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000D2A13CCCDCA83EFFDCA83EFFDCA83EFFDCA83EFFDCA83EFFDCA83EFFDCA83EFFDCA83EFFDCA83EFFDCA83EFFDCA83EFFDCA83EFFDCA83EFFDCA83EFFD2A13DCB00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000DCA83FF2DEAA3FFFDEAA3FFFDEAA3FFFDEAA3FFFDEAA3FFFDEAA3FFFDEAA3FFFDEAA3FFFDEAA3FFFDEAA3FFFDEAA3FFFDEAA3FFFDEAA3FFFDEAA3FFFDDA93FEF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000DFAB41F3DFAB41FFDFAB41FFDFAB41FFDFAB41FFDFAB41FFDFAB41FFDFAB41FFDFAB" $ico &= "41FFDFAB41FFDFAB41FFDFAB41FFDFAB41FFDFAB41FFDFAB41FFDFAB41EF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E1AD42F3E1AD42FFE1AD42FFE1AD42FFE1AD42FFE1AD42FFE1AD42FFE1AD42FFE1AD42FFE1AD42FFE1AD42FFE1AD42FFE1AD42FFE1AD42FFE1AD42FFE0AC42EF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E2AE44F3E2AE44FFE2AE44FFE2AE44FFE2AE44FFE2AE44FFE2AE44FFE2AE44FFE2AE44FFE2AE44FFE2AE44FFE2AE44FFE2AE44FFE2AE44FFE2AE44FFE2AE44EF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E3AF45F3E3AF45FFE3AF45FFE3AF45FFE3AF45FFE3AF45FFE3AF45FFE3AF45FFE3AF45FFE3AF45FFE3AF45FFE3AF45FFE3AF45FFE3AF45FFE3AF45FFE3AF45EF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E5B147F3E5B147FFE5B147FFE5B147FFE5B147FFE5B147FFE5B147FFE5B147FFE5B1" $ico &= "47FFE5B147FFE5B147FFE5B147FFE5B147FFE5B147FFE5B147FFE5B147EF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E6B248F3E6B248FFE6B248FFE6B248FFE6B248FFE6B248FFE6B248FFE6B248FFE6B248FFE6B248FFE6B248FFE6B248FFE6B248FFE6B248FFE6B248FFE6B248EF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E7B34AF3E7B34AFFE7B34AFFE7B34AFFE7B34AFFE7B34AFFE7B34AFFE7B34AFFE7B34AFFE7B34AFFE7B34AFFE7B34AFFE7B34AFFE7B34AFFE7B34AFFE7B34AEF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E9B54BF3E9B54BFFE9B54BFFE9B54BFFE9B54BFFE9B54BFFE9B54BFFE9B54BFFE9B54BFFE9B54BFFE9B54BFFE9B54BFFE9B54BFFE9B54BFFE9B54BFFE9B54BEF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000EAB64DF3EAB64DFFEAB64DFFEAB64DFFEAB64DFFEAB64DFFEAB64DFFEAB64DFFEAB6" $ico &= "4DFFEAB64DFFEAB64DFFEAB64DFFEAB64DFFEAB64DFFEAB64DFFEAB64DEF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ECB84EF3ECB84EFFECB84EFFECB84EFFECB84EFFECB84EFFECB84EFFECB84EFFECB84EFFECB84EFFECB84EFFECB84EFFECB84EFFECB84EFFECB84EFFEBB74EEF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000EDB950F1EDB950FFEDB950FFEDB950FFEDB950FFEDB950FFEDB950FFEDB950FFEDB950FFEDB950FFEDB950FFEDB950FFEDB950FFEDB950FFEDB950FFEDB950EE00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000EEBA51BFEEBA51FFEEBA51FFEEBA51FFEEBA51FFEEBA51FFEEBA51FFEEBA51FFEEBA51FFEEBA51FFEEBA51FFEEBA51FFEEBA51FFEEBA51FFEEBA51FFEEBA51BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000CDA1461FEFBB52B5F0BC52DFF0BC52DFF0BC52DFF0BC52DFF0BC52DFF0BC52DFF0BC" $ico &= "52DFF0BC52DFF0BC52DFF0BC52DFF0BC52DFF0BC52DFEFBB52B5D5A6491F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF" Return Binary("0x" & $ico) EndFunc ;==>_ico_Test01 Func _ico_Test02() Local $ico $ico &= "0000010001002040000001002000A8100000160000002800000020000000400000000100200000000000801000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003F95B71640AEDA4736B1E3722FB0E4972CB0E4B422B8EDC02ABBEDAD48BFE627000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003988A70940ADD64035B0" $ico &= "E0782EAFE3AF28AEE4E222ACE5FE22ACE5FF21AEE6FF1CB7ECFF10C1F6FF0AC8FCFF0AC8FCFF51D2F2350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003987A50544B1DB4033AFE1842BAEE3C724ADE4FA22ACE4FF22ADE5FF22ADE5FF23AFE6FF26BDEEFF21B9ECFF1ACAF9FF16C4F4FF06CAFEFF0CC7FAFF06CAFEFF79D8EC1500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000057A2BE0A40B4E1552CAFE3A825ADE4EF22ACE5FF21ADE4FF22ADE4FF22ACE5FF22ACE4FF22B2E8FF29BCECFF3BD1F7FF1FC2F0FF28CEF9FF20CCF9FF17C5F5FF09CBFEFF0CC7FAFF0BCBFDF2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000058B5D92A59BCE2BA28AEE4F122ADE4FF22ADE5FF22ADE5FF24AFE6FF26B0E6FF1FB4E9FF2FC2EEFF45CBF0FF1BBFEEFF31CBF3FF43D7F7FF1CC0EFFF2CD0F9FF24CDF8FF19C6F6FF0DCBFEFF0DC7FAFF0CCAFCE10000000000000000000000000000000000000000000000000000000000000000000000004593AF033CB5E58D24ADE5FC22ACE5FF22AEE6FF24B7EBFF29BCEDFF1FBCECFF2BC8F2FF54DBF7FF29C6F0FF1FC1EFFF67E1F6FF35CB" $ico &= "F1FF2AC8F1FF4CDBF9FF26C6F1FF2DCFF8FF28D0FAFF1AC7F6FF10CCFDFF0DC7FAFF11CAFCDB00000000000000000000000000000000000000000000000000000000000000000000000038B6E67C18B8EEFF12C0F5FF17C3F6FF1CC5F4FF20C5F3FF35D3F9FF3CD4F8FF22C4F0FF3CCFF4FF65E0F6FF2AC6EFFF4FD6F3FF62DFF6FF21C2EFFF4DDBF8FF35CFF5FF2BCCF7FF2AD2FCFF1BC7F6FF12CCFDFF0CC7FAFF0FCAFCDF00000000000000000000000000000000000000000000000000000000000000000000000032C9F45213C8F9F00FC7F9FF15CAFBFF1ECFFBFF28CEF9FF22C5F1FF3FD5F8FF4BDAF8FF27C5F1FF5CDCF5FF63DEF5FF2EC7F0FF68E2F7FF3BCFF3FF40D4F6FF40D7F9FF27C9F5FF2AD2FBFF1CC8F7FF11CDFDFF0DC7FAFF0FCAFCF63BA2BC0100000000000000000000000000000000000000000000000000000000000000000000000042CBF01A1DCDFCB512CAFBFF1CCAF8FF29D1FBFF32D3FBFF29C9F3FF48D9F8FF51DBF7FF33CAF1FF67E1F8FF45D2F4FF4ED7F5FF52DBF8FF33CDF4FF3FD7FAFF29CCF6FF27D1FBFF1BCAF8FF0ECCFDFF0CC7FAFF06CAFEFF53A9BD3200000000000000000000000000000000000000000000000000000000000000000000000000000000000000002FD0FA671DCEFCF422CAF7FF30D2FBFF3AD5FBFF2FCBF4FF4DDBF8FF49D7F6FF46D4F4FF59DEF8FF3CD0" $ico &= "F4FF4EDBF9FF36D1F6FF39D6FBFF2BCEF8FF23D0FBFF19CAFAFF0CCBFEFF0CC7FAFF0BC4F5FF3D676EF63735332900000000000000000000000000000000000000000000000000000000000000000000000000000000000000003FD2F72A28D0FBD824CCF7FF32D2FAFF3CD5FAFF36D0F5FF4BDBF9FF3FD3F6FF4BDAF8FF43D6F8FF40D6F9FF39D5FAFF2FD1FAFF28D1FBFF1ECAF6FF26AFD2FF3290A5FF477075FF59544CFF27231FFF1312129A00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044C5E41033D3FABA26CDF7FF32D2FAFF37D4F9FF36D2F7FF42D8FAFF3AD3F8FF3ED7FAFF38CEF2FF3EB2CDFF4393A3FF4D7479FF5D5B53FF675C52FF706559FF827467FF988878FF3C362FFF0D0D0DC40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051B0C6063ABAD8D324CCF7FF30D2F8FF39BDDDFF45A4B8FF4D8992FF566D6CFF655C54FF695F54FF706559FF786D60FF7F7164FF827265FF827466FF8D7E6EFF9B8B7AFF8C7D6FFF1414138D00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005F5C55CB4E6F72FF615F58FF7D7063FF958677FFA08F7EFF9F8F" $ico &= "7EFF908171FF7D7164FF7B7062FF7D7062FF7F7164FF827265FF827466FE908173DF9D8E7FA3A2938468534F4B0A000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000093867988B19E8CFFC7B19EFFCDB6A2FFCBB5A0FFB7A391FFA39281FF908171FF7D7164FF7B7062FF7F7265E784776B8E897D73548A80761A000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B7A89922C0AB99F9C7B29DFFCDB6A2FFCBB4A0FFB7A491FBA59685D9938677AC807568D97B7062FF807568A600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C3B09F6AC8B4A08FCDB9A55FCBB8A731A29487090000000000000000887E734B7B7062FF817568D50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" $ico &= "0000000000006B645D01807568D17D7163FD867D73210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000877C71637D7062FF85796D7600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007971690B7F7365F1827568D300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000082786B9B7E7163FF8C817538000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" $ico &= "0000000000000000000000000000887F73447F7164FF86786CA2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000071696106817366F1827266F98C807624000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000084776ABC827265FF887A6EAF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000085776B9D827265FF827466FE94887C3D00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" $ico &= "00000000000000000000000000000000000086786D8B827265FF827466FF8F8273B3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008B7F7364817265FFB5ADA5FF8E7F70F7776E640800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000081776E12837568EBD9D6D2FF96887AFF746A6017000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008B7F7537897C70D7908274C9766D6402000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" $ico &= "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFE01FFFFC001FFFC0001FFE00003FF800003FE000003FE000003FE000001FF000001FFC00000FFE00000FFF00000FFF80000FFFC0000FFFC000FFFFC007FFFFE0C7FFFFFFC3FFFFFFE3FFFFFFE3FFFFFFF1FFFFFFF1FFFFFFF0FFFFFFF8FFFFFFF87FFFFFF87FFFFFF83FFFFFF83FFFFFFC3FFFFFFFFF" Return Binary("0x" & $ico) EndFunc ;==>_ico_Test02 Func _Exit() _WinAPI_DeleteObject($hHBitmap) _WinAPI_DeleteObject($hHBitmap1) _WinAPI_DeleteObject($hHBitmap2) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit
    1 point
  8. You will need to unzip the the files/folders from the zip file after FileInstall. You can Run the extractor or use Shell.Application COM object to extract the .zip without external application. Edit : Also remember that there is a size limit of 2GB on FileInstall
    1 point
  9. The function name FileInstall can, in my opinion, be a bit misleading. As you have already discovered yourself, FileInstall will embed a file into the .exe and copy it to the specified destination directory when the .exe get's started. To unzip the file (let's take a .zip as an example), you need an additional step. One possibility would be to additionally embed the standalone command line variant of 7-Zip (7za.exe) into your script and use it to extract the .zip.
    1 point
  10. Thank you both. I ended up using WM_ACTIVATE.
    1 point
  11. Jos, Less of the "pilot error" please. "Chair-keyboard interface problem" is the acceptable terminology! M23
    1 point
  12. Danp2

    WebDriver UDF

    Here's a solution using @Chimp's _HtmlTable2Array UDF -- #include "wd_core.au3" #include "_HtmlTable2Array.au3" ; https://www.autoitscript.com/forum/topic/167679-read-data-from-html-tables-from-raw-html-source/ Local $sDesiredCapabilities, $sSession, $sElement, $sHTML, $aTable SetupGecko() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, 'https://courts.ie/judgments') ; Get the table element $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//table[@class='table alfresco-table']") ; Retrieve it's HTML $sHTML = _WD_ElementAction($sSession, $sElement, "Property", "outerHTML") $aTable = _HtmlTableGetWriteToArray($sHTML) _ArrayDisplay($aTable) _WD_DeleteSession($sSession) _WD_Shutdown() Func SetupGecko() _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace') _WD_Option('Port', 4444) $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"browserName": "firefox", "acceptInsecureCerts":true}}}' EndFunc
    1 point
  13. Screen scaling On Windows 10 a screen scaling different from 100% will likely mean that the red element rectangle is drawn at a wrong position and with a wrong size. The reason for this seems to be that the rectangle returned by $UIA_BoundingRectanglePropertyId is calculated relatively to the logical screen size that matches the scaling factor, and not to the physical size (in pixels) of the screen. There may be several reasons for a screen scaling different from 100%. One reason may be a high resolution screen where the scaling as default is set to eg. 150%. Another reason may be a normal screen where the scaling manually is set to eg. 125%. In the first case, a correct drawing of the rectangle may depend on whether or not the target application is DPI aware. In the last case, the rectangle will probably always be mistakenly drawn. On Windows 7 the element rectangle is still drawn correct even if the scaling is set to eg. 125%. The physical size of the screen seems to be taken into account when $UIA_BoundingRectanglePropertyId is calculated. Because there are many different situations it's tricky to handle the screen scaling properly. To get around the problem I've decided to add an Options menu where you have to select the scaling factor if it's not 100%. If $UIA_BoundingRectanglePropertyId is used to eg. set the mouse position to perform a click on the element, the scaling factor must be included to correctly calculate the mouse position. If the scaling is different from 100% the rectangle values of $UIA_BoundingRectanglePropertyId are simply multiplied with the scaling factor. In this situation both the original rectangle as returned by $UIA_BoundingRectanglePropertyId and the scaled rectangle are displayed in the right pane listview. New zip-file in bottom of first post.
    1 point
  14. I'm going to use these menus. I've updated the UDF, ModernMenuRaw.au3. Of the posts it appears that Holger updated the code on a regular basis until May 2008. ProgAndy made some updates in August 2008. These updates were about the background color of the menubar, the ability to use icon handles, and better cleanup code on exit. The updates I've made are based on the UDF by ProgAndy attached to post 213. It's my intention to update the UDF to make it run under the current versions of AutoIt, and to get rid of errors. Especially already known errors, which can be fixed in a few lines of code. It's not my intention to add a lot of new code to the UDF. Updates 2014-10-18 This update is based on original code by Holger (first post) and updates by ProgAndy (posts 211 - 213). The update supports AutoIt 3.3.10 and later. Code relating to Windows versions not supported by 3.3.10 is deleted. WindowsConstants.au3 is included and double-defined global constants are commented out. Added an update to be able to use colored controls e.g. buttons with this UDF. Post 222. Update (one line) for x64 support. Post 266 by Holger. Added x64 support to functions by ProgAndy. Declared a few local variables. Updates 2014-10-19 Updates to pass Au3Check. (-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6) Updates 2015-01-24 Updates for tray menus suggested by nickston (posts 298, 299, 312) Most important is an update that makes it possible to use a flashing tray menu icon. There are also a few code optimizations. Updates 2021-11-12 Disabled $IDI_ global constants in ModernMenuRaw.au3. $IDI_ constants are included in AutoItConstants.au3. None of the updates above are script breaking. If you are using tray menus and want to compile your script, you should pay attention to posts 268 - 270. Note also that _TrayIconCreate creates a GUI to receive messages from tray icons. After calling this function you should probably use GUISwitch($hGui) or something. Post 227. In the top of ModernMenuRaw.au3 I've included commands.txt from the original zip by Holger. Two commands of ProgAndy to handle the background color of the menubar are added. I've also added an alphabetical list of functions, and a list of Windows messages (used with GUIRegisterMsg). Examples In order to make it easy the examples are included in the zip. The original examples by Holger are included with no changes at all. The 32 examples by AZJIO in the post above are also included with no changes. There are two versions of the examples: an english and a russian. The examples demonstrates the commands one by one and are named with the name of the command. Copied an example by AZJIO and renamed it to _TrayIconSetState-flashing.au3. Added one line of code to make the tray menu icon flash. Only an english version. A new example by nickston that demonstrates a flashing tray menu icon. The example shows how to turn flashing on and off. Two new examples _GUICtrlCreateODTopMenu.au3 and _GUIMenuBarSetBkColor.au3 that demonstrates the commands by ProgAndy to set the background color of the menubar. _GUIMenuBarSetBkColor.au3 is not working on Windows 7. A new example that shows how to use a bitmap from an image list as an icon in a menu item. The example shows also how to use icon handles. 7z-file ModernMenuRaw.au3 - update on 12.11.2021 ModernMenuRaw.au3 - all previous versions ExamplesAZJIO - 32 examples by AZJIO in english and russian versions ExamplesHolger - the original examples by Holger Examplesnickston - flashing tray menu icon ExampleszNew - three new examples Tested with AutoIt 3.3.10 on Windows 7 32/64 bit and Windows XP 32 bit. 2014-10-19: ModernMenuRaw.7z 2015-01-24: ModernMenuRaw.7z Tested with AutoIt 3.3.14.2/5 and beta 3.3.15.4 on Windows 7/10 32/64 bit. ModernMenuRaw.7z
    1 point
  15. UEZ

    PNG button image

    Search the forum for "png bm_setimage button". Br, UEZ
    1 point
  16. That may be true, but the key difference is I was in the 0.001%, had the source code to AutoIt and knew how to hack it up to my needs.
    1 point
  17. O.K. that's a VERY special case and only necessary because AutoIT does not generally support pointers. So I guess, my statement ("There is no use for such a function") is still valid for 99,999 % of the AutoIT Users Cheers Kurt
    0 points
×
×
  • Create New...