Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/21/2019 in all areas

  1. Look in the SciTE Help under Contents tab -> SciTE4AutoIt3 -> Abbreviations List for a nicely organized list. Adam
    2 points
  2. I wish I read these 2 sentences more carefully, instead of debugging during hours the following issue : * Left side of the pic : though editing has started, my mouse pointer keeps its Arrow shape, so you can't click at a certain position inside the edited text (thanks Musashi for reporting this). Of course you can press the home key (or the end key) and the selection disappears, then edit without mouse support (because as soon as you click anywhere in the edit control, the edit automatically ends). Or you can even prevent the cell to be selected by commenting this line : _GUICtrlEdit_SetSel($hEdit, 0, -1) ; select all text (comment that line if you don't want the text to be selected) * Right side of the pic : editing has started and LarsJ's mouse pointer is a Text select pointer (as it should be in an edited control), which makes it easier to insert/suppress any character in the middle of the edited text. I also noticed that in Melba23's UDF (GUIListViewEx.au3), while editing, the mouse pointer appears the same as LarsJ's (a text select pointer), so I decided this afternoon to find the reason why mine was different, no matter how long it would take. Let's start with Melba23, then LarsJ. => Melba23 disables the Listview before edit starts, like this : ; Disable ListView WinSetState($hGLVEx_Editing, "", @SW_DISABLE) He probably disables it for other reasons but I noticed that, as soon as I commented this line, his mouse pointer turned to an Arrow, like mine ! => Now LarsJ's turn... step by step, I commented many blocks of code in EditControlKeyboard.au3 and Functions.au3, starting with each of the 3 "Subclass callback functions" (which unfortunately are a bit difficult for me to understand) as I felt that one of the 3 Subclass, when commented, would turn LarsJ's mouse pointer to an Arrow. Bad luck (or good luck in fact), even with the 3 Subclass code parts commented, his mouse pointer was still a Text select pointer. Anyway, at the very end part of debugging, when few active lines of code remained, I finally found the reason. Here is how I create the Edit control : $hEdit = _GUICtrlEdit_Create($hGUI, ... And here is how Lars creates it : $hEdit = _GUICtrlEdit_Create( $hListView, ... See the difference ? Now my mouse pointer wont be an Arrow anymore, though I need to re-adjust the coords of the Edit control
    2 points
  3. mikell

    regexp why not match ?

    ... and sorry, but I can't provide any details more cause my script is a so top secret wonderful piece of code
    2 points
  4. Not fully true as there is a pretty nifty autocomplete implemented that save a lot of typing for me.
    2 points
  5. My take: Local $a = [ _ "12-34-56-34-14-91", _ "12-34-56-80-04-54", _ "12-34-56-80-93-11", _ "12-34-56-EA-76-0F", _ "12-34-56-EA-76-9F", _ "12-34-56-EA-78-11", _ "12-39-56-80-93-11", _ "14-39-56-EA-76-0F", _ "52-34-56-80-04-54", _ "52-36-56-80-04-54" _ ] ; 1(2-3(4-56-(34-14-91|80-(04-54|93-11)|EA-7(6-(0F|9F)|8-11))|9-56-80-93-11)|4-39-56-EA-76-0F)|52-3(4-56-80-04-54|6-56-80-04-54) Local $b = $a ; argument $a below is Byref and will be modified. Make a solid copy if unchanged $a is needed later ; if necessary, perform array bounds check only once here Local $res = Prefixes($b) ConsoleWrite($res & @LF) ; factor out, in regex syntax, commun sub-prefixes from a sorted array of at least two distinct strings of equal length ; indices need $iStart > $iEnd, that is an index range of 2+ entries Func Prefixes(ByRef $aIn, $iStart = 0, $iEnd = UBound($aIn) - 1) If $iStart > $iEnd Then Return Local $sMatch, $sPrefix = $aIn[$iStart] For $i = $iStart To $iEnd - 1 $sMatch = Match($sPrefix, $aIn[$i + 1]) If $sMatch = "" Then ExitLoop EndIf $sPrefix = $sMatch Next Local $s1, $s2 If $i > $iStart Then For $j = $iStart To $i $aIn[$j] = StringTrimLeft($aIn[$j], StringLen($sPrefix)) Next $s1 = $sPrefix & '(' & Prefixes($aIn, $iStart, $i) & ')' Else $s1 = $aIn[$i] EndIf If $iStart = $i And $iEnd = $i + 2 Then $s2 = $aIn[$i + 1] & "|" & $aIn[$iEnd] Else $s2 = Prefixes($aIn, $i + 1, $iEnd) EndIf Return $s1 & ($s2 ? "|" & $s2 : "") EndFunc ; return the longest common prefix of two distinct strings of same length Func Match($s1, $s2) Local $i = 1 While StringLeft($s1, $i) = StringLeft($s2, $i) $i += 1 WEnd Return StringLeft($s1, $i - 1) EndFunc This code may not produce the shortest regex in some pathological cases, for instance a(b|c) is always longer than ab|ac whatever the prefix a and suffixes b and c consist of (entries have fixed length), but thinking twice you see that you can't expect to match exact input entries with a regex having non-nested parenthesized alternations, else any combination of substrings in alternation get matched, which have little chance to be in the input array. Example: Input: ["acf", "acg", "bce"] Wrong regex: (a|b)c(e|f|g) That would also match "ace", "acf", "bcf", "bcg" which aren't in input array. Correct regex: ac(f|g)|bce Also, forcing the prefix a to be longer than 1 character would preclude any input array where entries don't share at least the 2 head characters, failing flat on its nose with the test input I used. EDIT: forgot to mention that I suspect there is room for simplifying the various bound conditions tested here and there but I don't have enough time to dig further at the moment.
    2 points
  6. Thank you Mr. argumentum. I'm on AutoIt 3.3.14.2 and forgot to test on 3.3.14.5. Zip-file in both examples is updated.
    1 point
  7. #include <WinAPISysWin.au3> shows missing for AutoIt v3.3.14.5 Thanks for the update
    1 point
  8. I was able to just get this to work after changing some of the settings within IE. $oIE = _IECreate ("https://businesslogin.cerner.com/?ReturnUrl=https%3A%2F%2Fdistributions.cerner.com%2F") _IELoadWait($oIE) _IELinkClickByText($oIE, "Log in with CernerCare")
    1 point
  9. UIASpy updates to Windows 10 version 1809 Documentation for Windows 10 version 1809 updates can be found in Windows 8, Windows 8.1 and Windows 10 updates. This post is pretty much completely rewritten. In addition, there are a few minor updates that are documented below. A small but significant update is that in Sample code to find the application top window, $TreeScope_Descendants is replaced by $TreeScope_Children. The application top window is always a direct child of the Desktop. See the treeview in UIASpy. Therefore, this update can be made. This is a major performance update when the application window is not at the top of the Z-order of windows. UIA_MouseClick() in UIA_Functions.au3 is extended with right-click functionality. Sample code can be generated through Sample code | Code snippets ... In UIASpy.ini, through the DisplayScale key, you can specify the display scale you want when UIASpy starts up. Still not implemented update: Integrating $PropertyConditionFlags_MatchSubstring (Windows 10 1809) into Sample code. New zip-file at bottom of first post.
    1 point
  10. jchd

    regexp why not match ?

    Yeah and that isn't the rule as you know. I need this ... o wait, no, that instead ... but with cream please ... and without cream but in 3D, can you help?
    1 point
  11. mikell

    regexp why not match ?

    ... and all this sort of things Local $sLvar = "(1) 57,56" Local $aLQtt = StringRegExp($sLvar, "[\d,]+", 3) _ArrayDisplay($aLQtt)
    1 point
  12. if it doesn't start by either of those methods then it plain doesn't work. solution is to fix your service.
    1 point
  13. I modified my code, could you test it further. Seems it is working better now... #include <array.au3> $str = _ '12-34-56-34-14-91' & @CR & _ '12-34-56-80-04-54' & @CR & _ '12-34-56-80-93-11' & @CR & _ '12-34-56-EA-76-0F' & @CR & _ '12-34-56-EA-76-9F' & @CR & _ '12-34-56-EA-78-11' & @CR & _ '12-34-56-F1-00-22' & @CR & _ '12-34-57-F2-50-60' Global $aSplit[0][6] _ArrayAdd($aSplit , $str , 0 , "-" , @CR) Global Const $iMaxRow = Ubound($aSplit,1)-1,$iMaxCol = Ubound($aSplit,2)-1 Global $sRegExp = "" Solution (0,0,0, $iMaxRow,$iMaxCol) ClipPut ($sRegExp) MsgBox ($MB_SYSTEMMODAL,"",$sRegExp) Func Solution ($lvl,$sr, $sc, $er, $ec) $v = Same ($sr,$sc,$er) If $sr <> $er and $v <> $er and $lvl = 1 Then $sRegExp &= "(" EndIf $sRegExp &= $aSplit[$sr][$sc] if $sc < $ec Then $sRegExp &= "-" Solution (1,$sr, $sc+1, $v, $ec) EndIf if $v < $er then $sRegExp &= "|" Solution (2,$v+1, $sc, $er, $ec) if $lvl = 1 then $sRegExp &= ")" EndIf EndFunc Func Same ($sr, $c, $er) For $r = $sr+1 to $er If $aSplit[$r][$c] <> $aSplit[$sr][$c] Then Return $r-1 Next Return $er EndFunc
    1 point
  14. Using a virtual listview and this technique to extract data from the SQLite database will not generate any delay at all.
    1 point
  15. LarsJ

    Variants and Safearrays

    This week there have been some posts regarding use of compiled code in AutoIt through dll files and through C# and VB code via .NET. Use of compiled code is based, among other things, on Variants and Safearrays. This is an opportunity to distribute the latest updated version of these UDFs: Variant.au3 and SafeArray.au3. Variants and Safearrays are also used in UI Automation threads (Framework, UIASpy, Using) and in AutoItObject. In addition, references to these UDFs can be found in quite a number of posts. If you search for the UDFs it can be difficult to find the newest version. Hence this thread. Variant.au3: #include-once ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ; Copied from AutoItObject.au3 by the AutoItObject-Team: monoceres, trancexx, Kip, ProgAndy ; https://www.autoitscript.com/forum/index.php?showtopic=110379 Global Const $tagVARIANT = "word vt;word r1;word r2;word r3;ptr data; ptr" ; The structure takes up 16/24 bytes when running 32/64 bit ; Space for the data element at the end represents 2 pointers ; This is 8 bytes running 32 bit and 16 bytes running 64 bit Global Const $VT_EMPTY = 0 ; 0x0000 Global Const $VT_NULL = 1 ; 0x0001 Global Const $VT_I2 = 2 ; 0x0002 Global Const $VT_I4 = 3 ; 0x0003 Global Const $VT_R4 = 4 ; 0x0004 Global Const $VT_R8 = 5 ; 0x0005 Global Const $VT_CY = 6 ; 0x0006 Global Const $VT_DATE = 7 ; 0x0007 Global Const $VT_BSTR = 8 ; 0x0008 Global Const $VT_DISPATCH = 9 ; 0x0009 Global Const $VT_ERROR = 10 ; 0x000A Global Const $VT_BOOL = 11 ; 0x000B Global Const $VT_VARIANT = 12 ; 0x000C Global Const $VT_UNKNOWN = 13 ; 0x000D Global Const $VT_DECIMAL = 14 ; 0x000E Global Const $VT_I1 = 16 ; 0x0010 Global Const $VT_UI1 = 17 ; 0x0011 Global Const $VT_UI2 = 18 ; 0x0012 Global Const $VT_UI4 = 19 ; 0x0013 Global Const $VT_I8 = 20 ; 0x0014 Global Const $VT_UI8 = 21 ; 0x0015 Global Const $VT_INT = 22 ; 0x0016 Global Const $VT_UINT = 23 ; 0x0017 Global Const $VT_VOID = 24 ; 0x0018 Global Const $VT_HRESULT = 25 ; 0x0019 Global Const $VT_PTR = 26 ; 0x001A Global Const $VT_SAFEARRAY = 27 ; 0x001B Global Const $VT_CARRAY = 28 ; 0x001C Global Const $VT_USERDEFINED = 29 ; 0x001D Global Const $VT_LPSTR = 30 ; 0x001E Global Const $VT_LPWSTR = 31 ; 0x001F Global Const $VT_RECORD = 36 ; 0x0024 Global Const $VT_INT_PTR = 37 ; 0x0025 Global Const $VT_UINT_PTR = 38 ; 0x0026 Global Const $VT_FILETIME = 64 ; 0x0040 Global Const $VT_BLOB = 65 ; 0x0041 Global Const $VT_STREAM = 66 ; 0x0042 Global Const $VT_STORAGE = 67 ; 0x0043 Global Const $VT_STREAMED_OBJECT = 68 ; 0x0044 Global Const $VT_STORED_OBJECT = 69 ; 0x0045 Global Const $VT_BLOB_OBJECT = 70 ; 0x0046 Global Const $VT_CF = 71 ; 0x0047 Global Const $VT_CLSID = 72 ; 0x0048 Global Const $VT_VERSIONED_STREAM = 73 ; 0x0049 Global Const $VT_BSTR_BLOB = 0xFFF Global Const $VT_VECTOR = 0x1000 Global Const $VT_ARRAY = 0x2000 Global Const $VT_BYREF = 0x4000 Global Const $VT_RESERVED = 0x8000 Global Const $VT_ILLEGAL = 0xFFFF Global Const $VT_ILLEGALMASKED = 0xFFF Global Const $VT_TYPEMASK = 0xFFF ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ;Global Const $tagVARIANT = "word vt;word r1;word r2;word r3;ptr data; ptr" ; The structure takes up 16/24 bytes when running 32/64 bit ; Space for the data element at the end represents 2 pointers ; This is 8 bytes running 32 bit and 16 bytes running 64 bit #cs DECIMAL structure https://msdn.microsoft.com/en-us/library/windows/desktop/ms221061(v=vs.85).aspx From oledb.h: typedef struct tagDEC { USHORT wReserved; ; vt, 2 bytes union { ; r1, 2 bytes struct { BYTE scale; BYTE sign; }; USHORT signscale; }; ULONG Hi32; ; r2, r3, 4 bytes union { ; data, 8 bytes struct { #ifdef _MAC ULONG Mid32; ULONG Lo32; #else ULONG Lo32; ULONG Mid32; #endif }; ULONGLONG Lo64; }; } DECIMAL; #ce Global Const $tagDEC = "word wReserved;byte scale;byte sign;uint Hi32;uint Lo32;uint Mid32" ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ; Variant functions ; Copied from AutoItObject.au3 by the AutoItObject-Team: monoceres, trancexx, Kip, ProgAndy ; https://www.autoitscript.com/forum/index.php?showtopic=110379 ; #FUNCTION# ==================================================================================================================== ; Name...........: VariantClear ; Description ...: Clears the value of a variant ; Syntax.........: VariantClear($pvarg) ; Parameters ....: $pvarg - the VARIANT to clear ; Return values .: Success - 0 ; Failure - nonzero ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: VariantFree ; Link ..........: http://msdn.microsoft.com/en-us/library/ms221165.aspx ; Example .......: ; =============================================================================================================================== Func VariantClear($pvarg) ; Author: Prog@ndy Local $aCall = DllCall("OleAut32.dll", "long", "VariantClear", "ptr", $pvarg) If @error Then Return SetError(1, 0, 1) Return $aCall[0] EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: VariantCopy ; Description ...: Copies a VARIANT to another ; Syntax.........: VariantCopy($pvargDest, $pvargSrc) ; Parameters ....: $pvargDest - Destionation variant ; $pvargSrc - Source variant ; Return values .: Success - 0 ; Failure - nonzero ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: VariantRead ; Link ..........: http://msdn.microsoft.com/en-us/library/ms221697.aspx ; Example .......: ; =============================================================================================================================== Func VariantCopy($pvargDest, $pvargSrc) ; Author: Prog@ndy Local $aCall = DllCall("OleAut32.dll", "long", "VariantCopy", "ptr", $pvargDest, 'ptr', $pvargSrc) If @error Then Return SetError(1, 0, 1) Return $aCall[0] EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: VariantInit ; Description ...: Initializes a variant. ; Syntax.........: VariantInit($pvarg) ; Parameters ....: $pvarg - the VARIANT to initialize ; Return values .: Success - 0 ; Failure - nonzero ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: VariantClear ; Link ..........: http://msdn.microsoft.com/en-us/library/ms221402.aspx ; Example .......: ; =============================================================================================================================== Func VariantInit($pvarg) ; Author: Prog@ndy Local $aCall = DllCall("OleAut32.dll", "long", "VariantInit", "ptr", $pvarg) If @error Then Return SetError(1, 0, 1) Return $aCall[0] EndFunc ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Func VariantChangeType( $pVarDest, $pVarSrc, $wFlags, $vt ) Local $aRet = DllCall( "OleAut32.dll", "long", "VariantChangeType", "ptr", $pVarDest, "ptr", $pVarSrc, "word", $wFlags, "word", $vt ) If @error Then Return SetError(1,0,1) Return $aRet[0] EndFunc Func VariantChangeTypeEx( $pVarDest, $pVarSrc, $lcid, $wFlags, $vt ) Local $aRet = DllCall( "OleAut32.dll", "long", "VariantChangeTypeEx", "ptr", $pVarDest, "ptr", $pVarSrc, "word", $lcid, "word", $wFlags, "word", $vt ) If @error Then Return SetError(1,0,1) Return $aRet[0] EndFunc Func VarAdd( $pVarLeft, $pVarRight, $pVarResult ) Local $aRet = DllCall( "OleAut32.dll", "long", "VarAdd", "ptr", $pVarLeft, "ptr", $pVarRight, "ptr", $pVarResult ) If @error Then Return SetError(1,0,1) Return $aRet[0] EndFunc Func VarSub( $pVarLeft, $pVarRight, $pVarResult ) Local $aRet = DllCall( "OleAut32.dll", "long", "VarSub", "ptr", $pVarLeft, "ptr", $pVarRight, "ptr", $pVarResult ) If @error Then Return SetError(1,0,1) Return $aRet[0] EndFunc ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ; BSTR (basic string) functions ; Copied from AutoItObject.au3 by the AutoItObject-Team: monoceres, trancexx, Kip, ProgAndy ; https://www.autoitscript.com/forum/index.php?showtopic=110379 Func SysAllocString( $str ) Local $aRet = DllCall( "OleAut32.dll", "ptr", "SysAllocString", "wstr", $str ) If @error Then Return SetError(1, 0, 0) Return $aRet[0] EndFunc Func SysFreeString( $pBSTR ) If Not $pBSTR Then Return SetError(1, 0, 0) DllCall( "OleAut32.dll", "none", "SysFreeString", "ptr", $pBSTR ) If @error Then Return SetError(2, 0, 0) EndFunc Func SysReadString( $pBSTR, $iLen = -1 ) If Not $pBSTR Then Return SetError(1, 0, "") If $iLen < 1 Then $iLen = SysStringLen( $pBSTR ) If $iLen < 1 Then Return SetError(2, 0, "") Return DllStructGetData( DllStructCreate( "wchar[" & $iLen & "]", $pBSTR ), 1 ) EndFunc Func SysStringLen( $pBSTR ) If Not $pBSTR Then Return SetError(1, 0, 0) Local $aRet = DllCall( "OleAut32.dll", "uint", "SysStringLen", "ptr", $pBSTR ) If @error Then Return SetError(2, 0, 0) Return $aRet[0] EndFunc ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Func VarBstrCat( $pBSTRLeft, $pBSTRRight, $pBSTRResult ) Local $aRet = DllCall( "OleAut32.dll", "long", "VarBstrCat", "ptr", $pBSTRLeft, "ptr", $pBSTRRight, "ptr", $pBSTRResult ) If @error Then Return SetError(1,0,1) Return $aRet[0] EndFunc SafeArray.au3: #include-once Global Const $tagSAFEARRAYBOUND = _ "ulong cElements;" & _ ; The number of elements in the dimension. "long lLbound;" ; The lower bound of the dimension. Global Const $tagSAFEARRAY = _ "ushort cDims;" & _ ; The number of dimensions. "ushort fFeatures;" & _ ; Flags, see below. "ulong cbElements;" & _ ; The size of an array element. "ulong cLocks;" & _ ; The number of times the array has been locked without a corresponding unlock. "ptr pvData;" & _ ; The data. $tagSAFEARRAYBOUND ; One $tagSAFEARRAYBOUND for each dimension. ; fFeatures flags Global Const $FADF_AUTO = 0x0001 ; An array that is allocated on the stack. Global Const $FADF_STATIC = 0x0002 ; An array that is statically allocated. Global Const $FADF_EMBEDDED = 0x0004 ; An array that is embedded in a structure. Global Const $FADF_FIXEDSIZE = 0x0010 ; An array that may not be resized or reallocated. Global Const $FADF_RECORD = 0x0020 ; An array that contains records. When set, there will be a pointer to the IRecordInfo interface at negative offset 4 in the array descriptor. Global Const $FADF_HAVEIID = 0x0040 ; An array that has an IID identifying interface. When set, there will be a GUID at negative offset 16 in the safearray descriptor. Flag is set only when FADF_DISPATCH or FADF_UNKNOWN is also set. Global Const $FADF_HAVEVARTYPE = 0x0080 ; An array that has a variant type. The variant type can be retrieved with SafeArrayGetVartype. Global Const $FADF_BSTR = 0x0100 ; An array of BSTRs. Global Const $FADF_UNKNOWN = 0x0200 ; An array of IUnknown*. Global Const $FADF_DISPATCH = 0x0400 ; An array of IDispatch*. Global Const $FADF_VARIANT = 0x0800 ; An array of VARIANTs. Global Const $FADF_RESERVED = 0xF008 ; Bits reserved for future use. ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ; Safearray functions ; Copied from AutoItObject.au3 by the AutoItObject-Team: monoceres, trancexx, Kip, ProgAndy ; https://www.autoitscript.com/forum/index.php?showtopic=110379 Func SafeArrayCreate($vType, $cDims, $tsaBound) ; Author: Prog@ndy Local $aCall = DllCall("OleAut32.dll", "ptr", "SafeArrayCreate", "dword", $vType, "uint", $cDims, "struct*", $tsaBound) If @error Then Return SetError(1, 0, 0) Return $aCall[0] EndFunc Func SafeArrayDestroy($pSafeArray) ; Author: Prog@ndy Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayDestroy", "ptr", $pSafeArray) If @error Then Return SetError(1, 0, 1) Return $aCall[0] EndFunc Func SafeArrayAccessData($pSafeArray, ByRef $pArrayData) ; Author: Prog@ndy Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayAccessData", "ptr", $pSafeArray, "ptr*", 0) If @error Then Return SetError(1, 0, 1) $pArrayData = $aCall[2] Return $aCall[0] EndFunc Func SafeArrayUnaccessData($pSafeArray) ; Author: Prog@ndy Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayUnaccessData", "ptr", $pSafeArray) If @error Then Return SetError(1, 0, 1) Return $aCall[0] EndFunc Func SafeArrayGetUBound($pSafeArray, $iDim, ByRef $iBound) ; Author: Prog@ndy Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayGetUBound", "ptr", $pSafeArray, "uint", $iDim, "long*", 0) If @error Then Return SetError(1, 0, 1) $iBound = $aCall[3] Return $aCall[0] EndFunc Func SafeArrayGetLBound($pSafeArray, $iDim, ByRef $iBound) ; Author: Prog@ndy Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayGetLBound", "ptr", $pSafeArray, "uint", $iDim, "long*", 0) If @error Then Return SetError(1, 0, 1) $iBound = $aCall[3] Return $aCall[0] EndFunc Func SafeArrayGetDim($pSafeArray) Local $aResult = DllCall("OleAut32.dll", "uint", "SafeArrayGetDim", "ptr", $pSafeArray) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Func SafeArrayCopy( $psaSource, ByRef $psaDestination ) Local $aRet = DllCall( "OleAut32.dll", "int", "SafeArrayCopy", "ptr", $psaSource, "ptr*", 0 ) If @error Then Return SetError(1,0,1) $psaDestination = $aRet[2] Return $aRet[0] EndFunc Func SafeArrayCopyData( $psaSource, $psaDestination ) Local $aRet = DllCall( "OleAut32.dll", "int", "SafeArrayCopyData", "ptr", $psaSource, "ptr", $psaDestination ) If @error Then Return SetError(1,0,1) Return $aRet[0] EndFunc Func SafeArrayCreateEmptyWr( $vType ) Local $tsaBound = DllStructCreate( $tagSAFEARRAYBOUND ) DllStructSetData( $tsaBound, "cElements", 0 ) DllStructSetData( $tsaBound, "lLbound", 0 ) Return SafeArrayCreate( $vType, 0, $tsaBound ) EndFunc Func SafeArrayDestroyData( $pSafeArray ) Local $aRet = DllCall( "OleAut32.dll", "int", "SafeArrayDestroyData", "ptr", $pSafeArray ) If @error Then Return SetError(1,0,1) Return $aRet[0] EndFunc Func SafeArrayGetVartype( $pSafeArray, ByRef $iVartype ) Local $aRet = DllCall( "OleAut32.dll", "int", "SafeArrayGetVartype", "ptr", $pSafeArray, "ptr*", 0 ) If @error Then Return SetError(1,0,1) $iVartype = $aRet[2] Return $aRet[0] EndFunc Func SafeArrayRedim( ByRef $pSafeArray, $tsaBound ) Local $aRet = DllCall( "OleAut32.dll", "int", "SafeArrayRedim", "ptr", $pSafeArray, "struct*", $tsaBound ) If @error Then Return SetError(1,0,1) $pSafeArray = $aRet[1] Return $aRet[0] EndFunc SafeArrayCreateEmptyWr() is a wrapper function to create an empty safearray. It's not a translation of a similar Windows API function. AutoIt arrays are safearrays Note that AutoIt arrays are stored internally as safearrays. AutoIt arrays are accessed through normal AutoIt variables, and a set of operators and functions have been created to manipulate the arrays. This makes AutoIt arrays proprietary arrays that cannot be easily used in other programming languages. Zip-file You need AutoIt 3.3.12 or later. Tested on Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. VariantsSafearrays.7z
    1 point
  16. Hi. Script writed by MAT. It works excelent. Local $sCommand = "c:\windows\system32\snmputil.exe get 176.88.15.30 Public .1.3.6.1.2.1.2.2.1.10.4" MsgBox (0, "", _RunCmd ($sCommand)) Func _RunCmd ($sCommand) If StringLeft ($sCommand, 1) = " " Then $sCommand = " " & $sCommand Local $nPid = Run (@Comspec & " /c" & $sCommand, "", @SW_Hide, 8), $sRet = "" If @Error then Return "ERROR:" & @ERROR ProcessWait ($nPid) While 1 $sRet &= StdoutRead($nPID) If @error Or (Not ProcessExists ($nPid)) Then ExitLoop WEnd Return $sRet EndFunc ; ==> _RunCmd
    1 point
  17. IS WORKING !!!!! THANK YOU !!!! Thanks all for your patience. Netmastro
    1 point
×
×
  • Create New...