Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/13/2025 in all areas

  1. Thank you very much ioa747 , that's exactly what I was looking for 🙂 Have a great weekend, both of you. Reggards
    2 points
  2. May you release it on github.com ? Then we be able to look over enttire udf and have a better look
    2 points
  3. I just came across some odd behavior when automating a third party software app. On this third party app, there's a dialog with an edit control where you can enter an ID number that's 9 digits long. As soon as you enter the 9th digit the app immediately checks to see if it recognizes the ID as being an existing customer and if it does, it pops up a modal Yes/No window asking if you want to autofill the customer's information on the rest of the dialog. This popup correctly occurs whether my AutoIt app fills the edit control with 9 digits using ControlSetText or ControlSend. My AutoIt app needs to know whether the popup happens in order to determine its next action, so I follow the ControlSetText or ControlSend with a WinWait call looking for the popup, with a 2 second timeout. Here's where the odd behavior comes. If I fill the edit control using ControlSetText and the popup window appears, my WinWait doesn't start looking for the popup window until after the user has clicked Yes or No on it (and thereby dismissed the window). The AutoIt app just sits there idle the entire time that the Yes/No window is visible. Then as soon as the user clicks Yes or No (and dismisses the modal window), the WinWait immediately begins looking for that (now dismissed) window and of course never finds it. If I instead fill the edit control with ControlSend, AutoIt doesn't hang while the Yes/No window is visible, and WinWait immediately finds the window as expected. My guess is that the 3rd party app is popping up the modal Yes/No window before the original dialog can provide the return code from ControlSetText's underlying SendMessage command (probably due to some improper subclassing in the 3rd party app that shows the popup dialog before allowing the WndProc function to complete its operation and return a value). As a result, AutoIt is left sitting there waiting for that message before the ControlSetText function completes and it can move on to the next line of the script. Once the user dismisses the modal Yes/No window and the original dialog can continue, the return code gets received by AutoIt, the ControlSetText command finishes, and the script continues. With the ControlSend command, AutoIt apparently doesn't get stuck waiting for a return message, and can proceed with finding the window and acting accordingly. So I'm not looking for a solution, since using ControlSend is the workaround. Just posting here in case someone else comes across something similar and is banging their head on the keyboard as I was.
    1 point
  4. argumentum

    MustReturnArray()

    #include <WinAPIProc.au3> ; for the example Func MustReturnArray($aArray, $iColumns = 0, $iErr = @error, $iExt = @extended) If UBound($aArray) Then Return SetError($iErr, $iExt, $aArray) If $iColumns Then Dim $aArray[1][$iColumns] = [[0]] Else Dim $aArray[1] = [0] EndIf Return SetError($iErr, $iExt, $aArray) EndFunc ;==>MustReturnArray Exit MustReturnArray_Example() Func MustReturnArray_Example() ; worry free return Local $aWinList = WinList("nah, is not there") For $n = 1 To $aWinList[0][0] ConsoleWrite($aWinList[$n][1] & @TAB & $aWinList[$n][0] & @CRLF) Next ; worry free return Local $aProcessList = ProcessList("nah, is not there") For $n = 1 To $aProcessList[0][0] ConsoleWrite($aProcessList[$n][1] & @TAB & $aProcessList[$n][0] & @CRLF) Next ; solution ; create a "worry free return" Local $aArray = MustReturnArray(_WinAPI_EnumProcessWindows(4), 2) For $n = 1 To $aArray[0][0] ConsoleWrite($aArray[$n][1] & @TAB & $aArray[$n][0] & @CRLF) Next ; problem ; not a "worry free return" Local $aArray = _WinAPI_EnumProcessWindows(4) For $n = 1 To $aArray[0][0] ConsoleWrite($aArray[$n][1] & @TAB & $aArray[$n][0] & @CRLF) Next EndFunc ;==>MustReturnArray_Example Before I start with my problem ( and solution ), a big thank you to everyone coding these UDFs. AutoIt would not be what it is without them. ... a coder should always check @error, but is a pain, or not. In any case, the internal AutoIt functions return an array even if nothing there when an array is what it returns on success. Am so used to it, that when I use a UDF function I have to RTFM and I don't like reading ( nor writing but here we are 🤷‍♂️ ) How should I solve this problem given my coding style that does not include a failing function returning a zero stead of the array I was expecting. AutoIt does it, why does the UDFs not do it ?, ... must be a professional coders thing but, am a scripter. I write scripts. So, if it should return an array, then MustReturnArray() !. I hope this idea/function helps you avoid the " ==> Subscript used on non-accessible variable. " and/or simplify your code
    1 point
  5. No problems And yep, _ArrayDisplay() works the same way as ioa's example 👍
    1 point
  6. Hi everybody, I am completing webview2 udf, I have a problem and I hope everyone will help me For example: I am working with ICoreWebView2AcceleratorKeyPressedEventArgs2 interface, how can I declare it with ObjCreateInterface. Should I separate it into 2 Ivoke functions or one. This is my script : Global $oICoreWebView2AcceleratorKeyPressedEventArgs2, $pICoreWebView2AcceleratorKeyPressedEventArgs2 Global Const $sIID_ICoreWebView2AcceleratorKeyPressedEventArgs2 = "{03B2C8C8-7799-4E34-BD66-ED26AA85F2BF}" Global Const $dtag_ICoreWebView2AcceleratorKeyPressedEventArgs2 = _ "get_IsBrowserAcceleratorKeyEnabled HRESULT(BOOLEAN*);"& _ "put_IsBrowserAcceleratorKeyEnabled HRESULT(BOOLEAN);" Func ICoreWebView2AcceleratorKeyPressedEventHandler_Ivoke($pSelf, $pErrorCode, $pResult) $oICoreWebView2AcceleratorKeyPressedEventArgs = ObjCreateInterface( $pResult, $sIID_ICoreWebView2AcceleratorKeyPressedEventArgs, $dtag_ICoreWebView2AcceleratorKeyPressedEventArgs ) ;~ $oICoreWebView2AcceleratorKeyPressedEventArgs2 = ObjCreateInterface( $sIID_ICoreWebView2AcceleratorKeyPressedEventArgs, $sIID_ICoreWebView2AcceleratorKeyPressedEventArgs2, $dtag_ICoreWebView2AcceleratorKeyPressedEventArgs2 ) Return 0 #forceref $pSelf, $pErrorCode, $pResult EndFunc thanks for reading
    1 point
×
×
  • Create New...