Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/09/2023 in all areas

  1. OtherSmes is an array which in your example has only either 1 entry or none. However, you pass $i as the index for this array - and this runs from 0 to 2. Therefore, you only have a chance to get the value in the first loop pass where $i still has the value 0. If you write it this way, however, you will get all the OtherSME from your example: $other_sme = Json_Get($oJson, "[" & $x & "].Ownership.OtherSmes[0]") I recommend you to visualize the JSON structure for yourself. There are many online tools for that. Then the structure becomes clearer.
    2 points
  2. Hi @Aaron3569. In the docs for _GDIPlus_BitmapCreateHBITMAPFromBitmap the second argument is the background color that should support the alpha channel. So try this: _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap , 0x00000000) You did not provide example code for me to try the solution with, and I'm not feeling like making code to test this solution with currently, but it SHOULD work Hope it helps! Edit: I just realized you wanted to use _GDIPlus_BitmapCreateFromHBITMAP instead, my bad . I have some code that does this, so if you provide some example code to demonstrate the issue, I'll take the time to dig through my archive of files If not, there are solutions if you search enough within this forum 😅.
    1 point
  3. noellarkin

    AutoIt Snippets

    Async HTTP Requests I couldn't find the thread for "Async HTTP requests" and the corresponding code snippet, so I rewrote it. This code snippet sents Async GET requests to an array of URLs, and returns response code, response headers and response body as an array. #include-once #include <Array.au3> Local $HTTP_METHOD = "GET" Local $ASYNC_REQUEST = True Local $aURLs = ["https://en.wikipedia.org", "https://en.wikipedia.org/wiki/Forest_raven", "https://en.wikipedia.org/wiki/Stanley_Bruce", "https://en.wikipedia.org/wiki/Beatlemania"] Local $nTotalThreads = UBound($aURLs) Local $aRequestHandles[$nTotalThreads] Local $aThreadStatus[$nTotalThreads] Local $nCompletedThreads = 0 _ArrayColInsert($aURLs, 1) ; stores response code _ArrayColInsert($aURLs, 1) ; stores response headers _ArrayColInsert($aURLs, 1) ; stores response text For $i = 0 To $nTotalThreads - 1 $aRequestHandles[$i] = ObjCreate("WinHttp.WinHttpRequest.5.1") $aRequestHandles[$i].Open($HTTP_METHOD, $aURLs[$i][0], $ASYNC_REQUEST) $aRequestHandles[$i].Send() Next Do For $i = 0 To $nTotalThreads - 1 If $aThreadStatus[$i] = 0 And $aRequestHandles[$i].WaitForResponse(0) = True Then $aURLs[$i][1] = $aRequestHandles[$i].Status $aURLs[$i][2] = $aRequestHandles[$i].GetAllResponseHeaders $aURLs[$i][3] = $aRequestHandles[$i].ResponseText $aThreadStatus[$i] = 1 $nCompletedThreads += 1 EndIf Next Until $nCompletedThreads = $nTotalThreads _ArrayDisplay($aURLs) Explanation: First, we define variables: $HTTP_METHOD is set to "GET" as the request method. $ASYNC_REQUEST is set to True for asynchronous processing. $aURLs is an array of 4 URLs to be requested. $nTotalThreads is set to the upper bound of $aURLs, which is the number of elements in the array. $aRequestHandles is an array to store the request handles, with a length of $nTotalThreads. $aThreadStatus is an array to store the status of each thread, with a length of $nTotalThreads. $nCompletedThreads is a counter for the completed threads, which is initialized to 0. The next 3 lines insert 3 new columns in $aURLs to store the response status code, headers, and text. The next block of code performs a loop from 0 to $nTotalThreads - 1. Inside the loop, an object is created from the "WinHttp.WinHttpRequest.5.1" class and assigned to $aRequestHandles[$i]. The object's Open method is then called, with arguments $HTTP_METHOD, $aURLs[$i][0], and $ASYNC_REQUEST, to initiate the request. The object's Send method is then called to send the request. The next block of code is a do-until loop that waits until all threads have completed. Inside the loop, a nested for loop is performed from 0 to $nTotalThreads - 1. If a thread is not yet completed (indicated by $aThreadStatus[$i] being equal to 0) and has received a response (indicated by $aRequestHandles[$i].WaitForResponse(0) being equal to True), then the response status code, headers, and text are stored in $aURLs[$i][1], $aURLs[$i][2], and $aURLs[$i][3] respectively. The thread status is then set to completed (indicated by $aThreadStatus[$i] being equal to 1) and the $nCompletedThreads counter is incremented. The last line calls the _ArrayDisplay function with $aURLs as an argument, which displays the contents of the array.
    1 point
  4. water

    Advanced.Help

    Version 1.5.0.1

    945 downloads

    The F1 key in SciTE displays the documentation for the word on which the cursor is located. Up to now this was only available for AutoIt. But times change and we change with them Now with Advanced.Help ANY CHM help file (Compressed HTML Help) can be called with the F1 key. The only prerequisite: All function names have to start with the same identifier (like _AD_, _OL_ etc.). This tool, created by BugFix from the german forum and the help of Musashi, allows custom CHM help files to be included in SciTE. The existing help key is used to call either the AutoIt help or the corresponding custom help. Depending on which keyword the cursor is currently on. For unknown keywords the AutoIt help is called. For AutoIt a separate window is opened and for the user-defined UDFs another window is opened, so you can work with both helps at the same time. The ZIP file contains an installation guide in German (Install_Deutsch.txt) and English (Install_English.txt) in which the installation and configuration is described in detail. Most CHM help files come with UDFs you can download from this forum section (AD, OutlookEX, TaskScheduler). In addition we have added the preliminary release of the WebDriver help file. The most current CHM help file is now only distributed with the WebDriver UDF. BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort Known Bugs: (last changed: 2022-07-20) None
    1 point
×
×
  • Create New...