Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/19/2021 in all areas

  1. Just my 2 cents worth. Somewhere in this thread you say that your WD Capabilities UDF should become part of the WebDriver UDF. In this case, I would strongly recommend using the WebDriver UDF naming convention. The main benefit would be not to confuse users.
    2 points
  2. JockoDundee

    Error in Wiki

    What about instead of setting numerous variables to 9999 just doing it like this: Switch GUIGetMsg() Case $GUI_EVENT_NONE ContinueLoop ; or do nothing Case $GUI_EVENT_CLOSE ExitLoop Case $idButton1 MsgBox($MB_OK, "MsgBox 1", "Test from Gui 1") Case $idButton2 GUICtrlSetState($idButton2, $GUI_DISABLE) gui2() Case $g_idButton3 MsgBox($MB_OK, "MsgBox 2", "Test from Gui 2") EndSwitch
    2 points
  3. water

    AD - Active Directory UDF

    Version 1.6.3.0

    17,293 downloads

    Extensive library to control and manipulate Microsoft Active Directory. Threads: Development - General Help & Support - Example Scripts - Wiki Previous downloads: 30467 Known Bugs: (last changed: 2020-10-05) None Things to come: (last changed: 2020-07-21) None BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort
    1 point
  4. No need to specify = 4 since the previous is at 3. Glad you can run on my example. No problem.
    1 point
  5. Yes, it is the same question and was already CLOSED by @Jos one minute after it was published (it hardly gets any faster ).
    1 point
  6. As I promised, here it is: https://ulozto.net/file/f4RXDYHMtOcP/prospeed-zip https://ulozto.net/file/3UKjU2kfEQ66/prospeed-dll-zip https://ulozto.net/file/UKTdtv6AhY2G/demos-and-sourcecodes-autoit-zip
    1 point
  7. smbape

    OpenCV v4 UDF

    Hi @Lion66 The example I gave you is not working. This is a working example Local $matImg = _cveImreadAndCheck("cards.png", $CV_IMREAD_UNCHANGED) ConsoleWrite("channels " & _cveMatNumberOfChannels($matImg) & @CRLF & @CRLF) Local $vectorMv = _VectorOfMatCreate() _cveSplitTyped("Mat", $matImg, "VectorOfMat", $vectorMv) Local $tPtr = DllStructCreate("ptr value") For $i = 0 To _VectorOfMatGetSize($vectorMv) - 1 _VectorOfMatGetItemPtr($vectorMv, $i, $tPtr) _cveImshowMat("Channel " & $i, $tPtr.value) ; _cveWaitKey() Next _cveWaitKey() Not all png images have an alpha channel, so make sure to check that there are 4 channels before proceeding. The alpha channel will usually give you a white image because all pixels are opaque. By looking at the documentation, the mask can be empty. An empty mask is a mask which value is _cveMatCreate() or _cveNoArrayMat()
    1 point
  8. Just load the 2 pictures with GDI+. Use _GDIPlus_BitmapLockBits (see example) on the 2 pictures then compare integer (32 bits) by integer. If pictures are of different sizes, then resize them with _GDIPlus_ImageResize beforehand...
    1 point
  9. I don't know what to tell you about the "refresh rate" part, while on calling a function at time intervals, instead of continuously checking the elapsed time (If TimerDiff .....) you could either use the AdlibRegister command or the _WinAPI_SetTimer function. The first (AdlibRegister) is not executed while the script is displaying a blocking function (e.g. MsgBox, InputBox, WinWait, WinWaitClose etc.) while the second (_WinAPI_SetTimer) does not have this limitation. Here is a simple example of using _WinAPI_SetTimer: #include <WinAPISys.au3> ; get handle of a user-defined function. Global $hTimerProc = DllCallbackRegister('_UpdateUI', 'none', '') ; set the function call timer Global $iTimerID = _WinAPI_SetTimer(0, 0, 500, DllCallbackGetPtr($hTimerProc)) MsgBox(0, 'MsgBox', "I'm a blocking function" & @CRLF & _ "nevertheless the callback function is still called " & @CRLF & _ "...see the dot progression in the console output...") ; clear on exit _WinAPI_KillTimer(0, $iTimerID) DllCallbackFree($hTimerProc) ; function called by a timer. ; It is also run while a blocking function is shown ; (e.g. MsgBox, InputBox, WinWait, WinWaitClose etc.) ; Func _UpdateUI() ConsoleWrite('.') ; just to show something ... EndFunc ;==>_UpdateUI
    1 point
  10. why not: Func GetRef($sFunc) Return Execute($sFunc) EndFunc
    1 point
  11. TommyDDR

    Joystick UDF

    Hello, Am I the only one who have a problem with joyGetPosEx function ? I think, since upgrade to windows 10, joyGetPosEx works only if a window of our own process is active. Tell me if i'm lonely with this problem or if someone know how to bypass this restriction. Test program : #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Global $joy Global $gui Global $edit Global $size = [600, 240] Global $oldData = "" $gui = GUICreate("joy", $size[0], $size[1]) GUISetOnEvent($GUI_EVENT_CLOSE, quit, $gui) $edit = GUICtrlCreateEdit("", 0, 0, $size[0], $size[1], 0) GUICtrlSetState($edit, $GUI_DISABLE) GUICtrlSetFont($edit, Default, Default, Default, "Courier") GUISetState(@SW_SHOW, $gui) $joy = _JoyInit() OnAutoItExitRegister(_exit_joy) While 1 Local $txt = "Bouton |" Local $touches[8][0] Local $padValid[UBound($touches, 1)] For $i = 0 To UBound($touches, 1) - 1 Local $tches = processPad($i) $padValid[$i] = Not(@error) ReDim $touches[UBound($touches, 1)][UBound($tches, 1)] For $j = 0 To UBound($tches, 1) - 1 $touches[$i][$j] = $tches[$j] Next If($padValid[$i]) Then $txt &= " Pad " & $i & " |" EndIf Next $txt &= @CRLF For $i = 0 To UBound($touches, 2) - 1 $txt &= StringFormat("%6s", $i) & " |" For $j = 0 To UBound($touches, 1) - 1 If($padValid[$j]) Then $txt &= " " & ($touches[$j][$i] ? "1" : " ") & " |" EndIf Next $txt &= @CRLF Next If($oldData <> $txt) Then $oldData = $txt GUICtrlSetData($edit, $txt) EndIf Sleep(1) WEnd Func processPad($num) Local $array = _GetJoy($joy, $num) Local $touches[16] Local $isPadValid = StringLen($array[6]) > 0 $touches[0] = BitAND($array[7], 1) <> 0 $touches[1] = BitAND($array[7], 2) <> 0 $touches[2] = BitAND($array[7], 4) <> 0 $touches[3] = BitAND($array[7], 8) <> 0 $touches[4] = BitAND($array[7], 16) <> 0 $touches[5] = BitAND($array[7], 32) <> 0 $touches[6] = BitAND($array[7], 64) <> 0 $touches[7] = BitAND($array[7], 128) <> 0 $touches[8] = BitAND($array[7], 256) <> 0 $touches[9] = BitAND($array[7], 512) <> 0 $touches[10] = BitAND($array[7], 1024) <> 0 $touches[11] = BitAND($array[7], 2048) <> 0 $touches[12] = $isPadValid And $array[6] < 9000 Or $array[6] > 27000 And $array[6] < 65535 $touches[13] = $isPadValid And $array[6] > 0 And $array[6] < 18000 $touches[14] = $isPadValid And $array[6] > 9000 And $array[6] < 27000 $touches[15] = $isPadValid And $array[6] > 18000 And $array[6] < 36000 Return SetError(Not($isPadValid), 0, $touches) EndFunc Func _JoyInit() Local $joy Global $JOYINFOEX_struct = "dword[13]" $joy = DllStructCreate($JOYINFOEX_struct) if @error Then Return 0 DllStructSetData($joy,1,DllStructGetSize($joy),1);dwSize = sizeof(struct) DllStructSetData($joy,1,255,2) ;dwFlags = GetAll return $joy EndFunc Func _GetJoy($lpJoy, $iJoy) Local $ret Local $coor[9] $ret = DllCall("Winmm.dll", "int", "joyGetPosEx", "int", $iJoy, "ptr", DllStructGetPtr($lpJoy)) If(Not(@error) And $ret[0] == 0) Then $coor[0] = DllStructGetData($lpJoy,1,3) $coor[1] = DllStructGetData($lpJoy,1,4) $coor[2] = DllStructGetData($lpJoy,1,5) $coor[3] = DllStructGetData($lpJoy,1,6) $coor[4] = DllStructGetData($lpJoy,1,7) $coor[5] = DllStructGetData($lpJoy,1,8) $coor[6] = DllStructGetData($lpJoy,1,11) $coor[7] = DllStructGetData($lpJoy,1,9) $coor[8] = DllStructGetData($lpJoy,1,10) EndIf return $coor EndFunc Func _exit_joy() $joy = 0 EndFunc Func quit() Exit EndFunc Try to press buttons on your pad with and without having focus on window
    1 point
  12. Addition : I have written a small test script for people who are interested to compare the versions of @trancexx and @Ascer . You can 'play around' with it and make your own decision . #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <StringConstants.au3> Opt("MustDeclareVars", 1) Global $g_sEncoded, $g_sDecoded, $g_sString, $g_iTime ; Bigtext : Global $g_sString = BinaryToString(InetRead("https://www.autoitscript.com/forum/"), 4) ;~ Global $g_sString = "Hello World, öäü ÖÄÜ ß" ; for simple tests ConsoleWrite(@CRLF) ConsoleWrite("+ >> StringLen = " & StringLen($g_sString) & @CRLF) ; ----------- Trancexx : --------------- ConsoleWrite(@CRLF) ConsoleWrite("+ >>>>> Trancexx <<<<< :" & @CRLF) ; Encode : $g_iTime = TimerInit() $g_sEncoded = _Base64Encode($g_sString) $g_iTime = TimerDiff($g_iTime) ConsoleWrite(StringFormat("% 25s: %10.3f ms", "Trancexx Encoding Time", $g_iTime)) ConsoleWrite(@CRLF) ; Decode : $g_iTime = TimerInit() $g_sDecoded = _Base64Decode($g_sEncoded) $g_iTime = TimerDiff($g_iTime) ConsoleWrite(StringFormat("% 25s: %10.3f ms", "Trancexx Decoding Time", $g_iTime)) ConsoleWrite(@CRLF) ; !!! don't use this for long strings - better write to file : ConsoleWrite($g_sEncoded & @CRLF) ConsoleWrite(BinaryToString($g_sDecoded) & @CRLF) ; ----------- Ascer : --------------- ConsoleWrite(@CRLF) ConsoleWrite("+ >>>>> Ascer <<<<< :" & @CRLF) ; Encode : $g_iTime = TimerInit() $g_sEncoded = base64($g_sString) $g_iTime = TimerDiff($g_iTime) ConsoleWrite(StringFormat("% 25s: %10.3f ms", "Ascer Encoding Time ", $g_iTime)) ConsoleWrite(@CRLF) ; Decode : $g_iTime = TimerInit() $g_sDecoded = base64($g_sEncoded, False) $g_iTime = TimerDiff($g_iTime) ConsoleWrite(StringFormat("% 25s: %10.3f ms", "Ascer Decoding Time ", $g_iTime)) ConsoleWrite(@CRLF) ; !!! don't use this for long strings - better write to file : ConsoleWrite($g_sEncoded & @CRLF) ConsoleWrite(BinaryToString($g_sDecoded) & @CRLF) ; ======================= Functions : ========================= ;--------------------------------------------------------------------------------- ; Trancexx : Func _Base64Encode($input) $input = Binary($input) Local $struct = DllStructCreate("byte[" & BinaryLen($input) & "]") DllStructSetData($struct, 1, $input) Local $strc = DllStructCreate("int") Local $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", 0, _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call[0] Then Return SetError(1, 0, "") ; error calculating the length of the buffer needed EndIf Local $a = DllStructCreate("char[" & DllStructGetData($strc, 1) & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", DllStructGetPtr($a), _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call[0] Then Return SetError(2, 0, ""); error encoding EndIf Return DllStructGetData($a, 1) EndFunc ;==>_Base64Encode Func _Base64Decode($input_string) Local $struct = DllStructCreate("int") Local $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _ "str", $input_string, _ "int", 0, _ "int", 1, _ "ptr", 0, _ "ptr", DllStructGetPtr($struct, 1), _ "ptr", 0, _ "ptr", 0) If @error Or Not $a_Call[0] Then Return SetError(1, 0, "") ; error calculating the length of the buffer needed EndIf Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _ "str", $input_string, _ "int", 0, _ "int", 1, _ "ptr", DllStructGetPtr($a), _ "ptr", DllStructGetPtr($struct, 1), _ "ptr", 0, _ "ptr", 0) If @error Or Not $a_Call[0] Then Return SetError(2, 0, ""); error decoding EndIf Return DllStructGetData($a, 1) EndFunc ;==>_Base64Decode ;--------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------- ; Ascer ;============================================================================================================================== ; Function: base64($vCode [, $bEncode = True [, $bUrl = False]]) ; ; Description: Decode or Encode $vData using Microsoft.XMLDOM to Base64Binary or Base64Url. ; IMPORTANT! Encoded base64url is without @LF after 72 lines. Some websites may require this. ; ; Parameter(s): $vData - string or integer | Data to encode or decode. ; $bEncode - boolean | True - encode, False - decode. ; $bUrl - boolean | True - output is will decoded or encoded using base64url shema. ; ; Return Value(s): On Success - Returns output data ; On Failure - Returns 1 - Failed to create object. ; ; Author (s): (Ghads on Wordpress.com), Ascer ;=============================================================================================================================== Func base64($vCode, $bEncode = True, $bUrl = False) Local $oDM = ObjCreate("Microsoft.XMLDOM") If Not IsObj($oDM) Then Return SetError(1, 0, 1) Local $oEL = $oDM.createElement("Tmp") $oEL.DataType = "bin.base64" If $bEncode then $oEL.NodeTypedValue = Binary($vCode) If Not $bUrl Then Return $oEL.Text Return StringReplace(StringReplace(StringReplace($oEL.Text, "+", "-"),"/", "_"), @LF, "") Else If $bUrl Then $vCode = StringReplace(StringReplace($vCode, "-", "+"), "_", "/") $oEL.Text = $vCode Return $oEL.NodeTypedValue EndIf EndFunc ;==>base64 ;--------------------------------------------------------------------------------- My result : The version from trancexx is faster. With extremely long strings, the version from Ascer caused an error message during decoding (on my system).
    1 point
×
×
  • Create New...