Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/21/2022 in all areas

  1. Show your script using post code method. Add also your xls file, so we can test. Make your script runable to us and eliminate all not related lines. Thanks.
    2 points
  2. Hi @Nine, the idea of replacing \r\n with a "|" pipe for using in the RegEx pattern is quite awesome, I like it 👍 . For the file examples of @ahmeddzcom, absolutly valid and nice, as long as the file will not contain a pipe. Then it could come to an invalid verification 🤔 . Anyway, I am impressed because I did such things in a way more complex style in the past, which is obviously not needed 😀 . Best regards Sven ________________ Stay innovative!
    1 point
  3. Or : #include <Array.au3> Local $t1 = FileRead("T1.txt") Local $t2 = FileRead("T2.txt") $t2 = StringReplace($t2, @CRLF, "|") $a = StringRegExp($t1,"(" & $t2 & ")", 3) $a = _ArrayUnique($a) _ArrayDisplay($a) It could be done in a single line $a = _ArrayUnique(StringRegExp(FileRead("T1.txt"), "(" & StringReplace(FileRead("T2.txt"), @CRLF, "|") & ")", 3))
    1 point
  4. Nine

    Blank Record Reading.

    #AutoIt3Wrapper_UseX64=y solve your issue
    1 point
  5. Your while loop is a tad complex for nothing : While $contaCadastroFim > $contaCadastroInicio $excelCompatibilidade = _Excel_RangeRead($workBookComplete, Default, StringReplace($campoInicio, "A", "G"), 1, True) ConsoleWrite(">>>>> DESCRIÇÃO DA CÉLULA: " & $excelCompatibilidade & @CRLF) ConsoleWrite("<<<<< " & @CRLF) $contaCadastroInicio += 1 $campoInicio = StringLeft($campoInicio, 1) & $contaCadastroInicio WEnd
    1 point
  6. Please set parameter 5 to True to use the transpose method of the Excel UDF. This removes limitations of Excel's transpose method. Example: _Excel_RangeRead($workBookComplete, Default, $campoInicio, 1, True)
    1 point
  7. @MateusAMOK, Could you please refrain from translating the quoted text? Thanks.
    1 point
  8. Can you please post the exact _Excel_RangeRead statement you use? Can you please post the value of @error and @extended after calling _Excel_RangeRead? Did you read the wiki about Excel?
    1 point
  9. I use "@scriptdir" a lot in my script. When I run the cmd, the @scriptdir refers to the "syswow64" folder. (the current working folder used by auto3cmd) I fixed my script by specifying the correct folder with "FileChangeDir" and replacing the "@scriptdir" to "@workingdir" Seems to work fine now. Thank you.
    1 point
  10. pixelsearch

    Sort question in C++

    Hi everybody And we're done... all sort code is gathered and operational. Below is the final C++ code taking care of the three ways of sorting, the corresponding include file "SortAll.au3" and a file test2.au3 for trying (after you compile the C++ code) If I had to do any further modification, I'll do it in this very post, indicating the reason of the change. 1) C++ code to generate "SortAll.dll" #include <algorithm> #include <string> #include <vector> #include <windows.h> // ======================================================================================= // STRING Sort (0) // ======================================================================================= struct struct_alpha { std::wstring data; int index; }; bool sort_alpha_asc (const struct_alpha& v1, const struct_alpha& v2) { return v1.data < v2.data; } // no .c_str() or sort fails (tested) int sort_alpha (wchar_t* sbigdata, int* struct_indexes, wchar_t* sdelim, int irows, int istable) { std::vector<struct_alpha> vect(irows); // irows (and 2 cols from struct_alpha) std::wstring str = sbigdata; size_t ifound = 0, ipos = 0; for (int i = 0; i < irows; i++) { ifound = str.find(sdelim, ipos); vect[i].data = str.substr(ipos, ifound - ipos); // wide string vect[i].index = i; // row (to remember initial index before data sorting) ipos = ifound + 1; } if (istable == 0) std::sort(vect.begin(), vect.end(), sort_alpha_asc); else std::stable_sort(vect.begin(), vect.end(), sort_alpha_asc); for (int i = 0; i < irows; i++) *(struct_indexes + i) = vect[i].index; // index of sorted data... before data sorting //swap trick to release memory used by the string (str = L"" wouldn't release anything) std::wstring(L"").swap(str); // swap trick to release memory used by the vector : std::vector<struct_alpha>().swap(vect); return 0; } // ======================================================================================= // NUMERIC Sort (1) // ======================================================================================= struct struct_num { double data; int index; }; bool sort_num_asc (const struct_num& v1, const struct_num& v2) { return v1.data < v2.data; } int sort_num (wchar_t* sbigdata, int* struct_indexes, wchar_t* sdelim, int irows, int istable) { std::vector<struct_num> vect(irows); // irows (and 2 cols from struct_num) std::wstring str = sbigdata; std::wstring sfound; size_t ifound = 0, ipos = 0; for (int i = 0; i < irows; i++) { ifound = str.find(sdelim, ipos); sfound = str.substr(ipos, ifound - ipos); vect[i].data = wcstod (sfound.c_str(), NULL); // wide string to double. // .c_str() mandatory here. vect[i].index = i; // row (to remember initial index before data sorting) ipos = ifound + 1; } if (istable == 0) std::sort(vect.begin(), vect.end(), sort_num_asc); else std::stable_sort(vect.begin(), vect.end(), sort_num_asc); for (int i = 0; i < irows; i++) *(struct_indexes + i) = vect[i].index; // index of sorted data... before data sorting //swap trick to release memory used by the string (str = L"" wouldn't release anything) std::wstring(L"").swap(str); // swap trick to release memory used by the vector : std::vector<struct_num>().swap(vect); return 0; } // ======================================================================================= // NATURAL Sort (2) // ======================================================================================= /* Original StrCmpLogicalW function found in shlwapi.dll int StrCmpLogicalW( [in] PCWSTR psz1, [in] PCWSTR psz2 ); */ // create a matching typedef for the function pointer // typedef INT (CALLBACK* LPFNDLLFUNC1)(PCWSTR, PCWSTR); typedef int (__stdcall* pfunc)(const wchar_t*, const wchar_t*); HINSTANCE hDLL; // Handle to DLL pfunc StrCmpLogicalW; // Function pointer struct struct_natural { std::wstring data; int index; }; bool sort_natural_asc (const struct_natural& v1, const struct_natural& v2) { return StrCmpLogicalW(v1.data.c_str(), v2.data.c_str()) < 0; } int sort_natural (wchar_t* sbigdata, int* struct_indexes, wchar_t* sdelim, int irows, int istable) { hDLL = LoadLibrary("shlwapi.dll"); if (hDLL == NULL) return - 1; StrCmpLogicalW = (pfunc)GetProcAddress(hDLL, "StrCmpLogicalW"); if (!StrCmpLogicalW) { FreeLibrary(hDLL); return - 2; } std::vector<struct_natural> vect(irows); // irows (and 2 cols from struct_natural) std::wstring str = sbigdata; size_t ifound = 0, ipos = 0; for (int i = 0; i < irows; i++) { ifound = str.find(sdelim, ipos); vect[i].data = str.substr(ipos, ifound - ipos); // wide string vect[i].index = i; // row (to remember initial index before data sorting) ipos = ifound + 1; } if (istable == 0) std::sort(vect.begin(), vect.end(), sort_natural_asc); else std::stable_sort(vect.begin(), vect.end(), sort_natural_asc); for (int i = 0; i < irows; i++) *(struct_indexes + i) = vect[i].index; // index of sorted data... before data sorting //swap trick to release memory used by the string (str = L"" wouldn't release anything) std::wstring(L"").swap(str); // swap trick to release memory used by the vector : std::vector<struct_natural>().swap(vect); FreeLibrary(hDLL); return 0; } // ======================================================================================= // NATURAL Sort (3a) LarsJ's way, to match AutoIt ArrayDisplay output (UNSTABLE sort) // ======================================================================================= // 3 next lines already defined before => commented here : // typedef int (__stdcall* pfunc)(const wchar_t*, const wchar_t*); // HINSTANCE hDLL; // Handle to DLL // pfunc StrCmpLogicalW; // Function pointer int sort_natural3a_asc (const std::wstring& v1, const std::wstring& v2) { return StrCmpLogicalW(v1.c_str(), v2.c_str()); } // 0, -1, 1 int sort_natural3a (wchar_t* sbigdata, int* struct_indexes, wchar_t* sdelim, int irows) { hDLL = LoadLibrary("shlwapi.dll"); if (hDLL == NULL) return - 1; StrCmpLogicalW = (pfunc)GetProcAddress(hDLL, "StrCmpLogicalW"); if (!StrCmpLogicalW) { FreeLibrary(hDLL); return - 2; } std::vector<std::wstring> vect(irows); std::wstring str = sbigdata; size_t ifound = 0, ipos = 0; for (int i = 0; i < irows; i++) { ifound = str.find(sdelim, ipos); vect[i] = str.substr(ipos, ifound - ipos); // wide string ipos = ifound + 1; } int lo=0, hi=0, mi=0, r=0; for (int i = 1; i < irows; i++) { lo = 0; hi = i - 1; do { mi = (lo + hi) / 2; r = sort_natural3a_asc(vect[i], vect[*(struct_indexes + mi)]); if (r == -1) hi = mi - 1; else if (r == 1) lo = mi + 1; else break; } while (lo <= hi); memmove(struct_indexes + mi + 1, struct_indexes + mi, (i - mi) * 4); *(struct_indexes + mi + (lo == (mi + 1))) = i; } //swap trick to release memory used by the string (str = L"" wouldn't release anything) std::wstring(L"").swap(str); // swap trick to release memory used by the vector : std::vector<std::wstring>().swap(vect); FreeLibrary(hDLL); return 0; } // ======================================================================================= // NATURAL Sort (3b) LarsJ's way + STABLE sort (mine) // ======================================================================================= // 3 next lines already defined before => commented here : // typedef int (__stdcall* pfunc)(const wchar_t*, const wchar_t*); // HINSTANCE hDLL; // Handle to DLL // pfunc StrCmpLogicalW; // Function pointer int sort_natural3b_asc (const std::wstring& v1, const std::wstring& v2) { return StrCmpLogicalW(v1.c_str(), v2.c_str()); } // 0, -1, 1 int sort_natural3b (wchar_t* sbigdata, int* struct_indexes, wchar_t* sdelim, int irows) { hDLL = LoadLibrary("shlwapi.dll"); if (hDLL == NULL) return - 1; StrCmpLogicalW = (pfunc)GetProcAddress(hDLL, "StrCmpLogicalW"); if (!StrCmpLogicalW) { FreeLibrary(hDLL); return - 2; } std::vector<std::wstring> vect(irows); std::wstring str = sbigdata; size_t ifound = 0, ipos = 0; for (int i = 0; i < irows; i++) { ifound = str.find(sdelim, ipos); vect[i] = str.substr(ipos, ifound - ipos); // wide string ipos = ifound + 1; } std::vector<std::vector<int> > adupe(irows, std::vector<int>(3)); // irows and 3 cols int idupe, indx, irank, inb_elem, idiff, j; int lo=0, hi=0, mi=0, r=0; for (int i = 1; i < irows; i++) { lo = 0; hi = i - 1; do { mi = (lo + hi) / 2; r = sort_natural3b_asc(vect[i], vect[*(struct_indexes + mi)]); if (r == -1) hi = mi - 1; else if (r == 1) lo = mi + 1; else break; } while (lo <= hi); if (r == 0) { indx = *(struct_indexes + mi); idupe = adupe[indx][0]; if (idupe == 0) { adupe[indx][0] = i; adupe[indx][1] = 1; adupe[i][0] = i; adupe[i][1] = 2; adupe[i][2] = 2; memmove(struct_indexes + mi + 1, struct_indexes + mi, (i - mi) * 4); *(struct_indexes + mi + 1) = i; } else { irank = adupe[indx][1]; inb_elem = adupe[idupe][2]; idiff = inb_elem - irank; j = mi + 1 + idiff; memmove(struct_indexes + j + 1, struct_indexes + j, (i - j) * 4); *(struct_indexes + j) = i; adupe[i][0] = idupe; adupe[i][1] = inb_elem + 1; adupe[idupe][2] = inb_elem + 1; } } else { memmove(struct_indexes + mi + 1, struct_indexes + mi, (i - mi) * 4); *(struct_indexes + mi + (lo == (mi + 1))) = i; } } //swap trick to release memory used by the string (str = L"" wouldn't release anything) std::wstring(L"").swap(str); // swap trick to release memory used by the vector : std::vector<std::wstring>().swap(vect); // swap trick to release memory used by the 2D vector : std::vector<std::vector<int> >().swap(adupe); FreeLibrary(hDLL); return 0; } // ======================================================================================= // dll entry point for any of the sorting types (function to call depends on itype) // itype value checked by calling script "sortall.au3" (0=string, 1=num, 2 and 3 = natural) // ======================================================================================= extern "C" __declspec(dllexport) int sortall (wchar_t* sbigdata, int* struct_indexes, wchar_t* sdelim, int irows, int istable, int itype) { int iret = 0; switch(itype) { case 0: iret = sort_alpha (sbigdata, struct_indexes, sdelim, irows, istable); break; case 1: iret = sort_num (sbigdata, struct_indexes, sdelim, irows, istable); break; case 2: iret = sort_natural (sbigdata, struct_indexes, sdelim, irows, istable); break; case 3: // natural sort LarsJ's way : unstable sort OR stable sort (mine) if (istable==0) iret = sort_natural3a (sbigdata, struct_indexes, sdelim, irows); else iret = sort_natural3b (sbigdata, struct_indexes, sdelim, irows); break; default: // impossible (itype value checked by calling script "sortall.au3") iret = -3; // return 'error' -3 (error value not used in the functions above) } return iret; // 0 when no error in any function called. } 2) Include file "SortAll.au3" #include-once #include "AutoItConstants.au3" #include "MsgBoxConstants.au3" ;================================================================================ Func SortAll(ByRef $aArray, $iSortCol = 0, $iType = 2, $iSense = 0, $iStable = 0) If $iSortCol = Default Then $iSortCol = 0 ; first column = 0 If $iType = Default Then $iType = 2 ; 0 = String sort, 1 = Numeric sort, 2/3 = Natural sort If $iSense = Default Then $iSense = 0 ; 0 = ascending, 1 = descending If $iStable = Default Then $iStable = 0 ; 0 = unstable sort, 1 = stable sort If Not IsArray($aArray) Then MsgBox($MB_TOPMOST, "Error : Variable $aArray is not an Array", _ "Its type is : " & VarGetType($aArray)) Return SetError(1, 0, 0) EndIf Local $iDims = UBound($aArray, $UBOUND_DIMENSIONS) If $iDims < 1 Or $iDims > 2 Then MsgBox($MB_TOPMOST, "Error : Dimensions = " & $iDims, _ "Array is not 1D or 2D") Return SetError(2, 0, 0) EndIf Local $iRows = UBound($aArray, $UBOUND_ROWS) If $iRows = 0 Then MsgBox($MB_TOPMOST, "Nothing to sort", _ "Array got 0 row") Return SetError(3, 0, 0) EndIf Local $iCols = UBound($aArray, $UBOUND_COLUMNS) ; always 0 for 1D array. If $iDims = 2 Then If $iCols = 0 Then MsgBox($MB_TOPMOST, "Error", _ "2D Array got 0 columns") Return SetError(4, 0, 0) ElseIf $iSortCol < 0 Or $iSortCol > $iCols - 1 Then MsgBox($MB_TOPMOST, "Error : Sort column " & $iSortCol, _ "Please choose column between 0 and " & $iCols - 1) Return SetError(5, 0, 0) EndIf EndIf If $iType < 0 Or $iType > 3 Then MsgBox($MB_TOPMOST, "Unknown Sort Type " & $iType, _ "It should be : 0 = String sort, 1 = Numeric sort, 2/3 = Natural sort") Return SetError(6, 0, 0) EndIf If $iSense < 0 Or $iSense > 1 Then MsgBox($MB_TOPMOST, "Unknown Sort Sense" & $iSense, _ "It should be : 0 = Ascending, 1 = Descending") Return SetError(7, 0, 0) EndIf If $iStable < 0 Or $iStable > 1 Then MsgBox($MB_TOPMOST, "Unknown Sort Stability " & $iStable, _ "It should be : 0 = Unstable sort, 1 = Stable sort") Return SetError(8, 0, 0) EndIf Local $hDLLSort = DllOpen("sortall.dll") ; as no path indicated, dll is searched first in path environment, then in script path. ; if path is indicated (@ScriptDir for example), then it's the contrary. If $hDLLSort = -1 Then MsgBox($MB_TOPMOST, "Error", _ "sortall.dll can't be opened") Return SetError(20, 0, 0) EndIf Local $tStruct2 = DllStructCreate("int[" & $iRows & "]") ; will be filled by dll If @error Then MsgBox($MB_TOPMOST, "DllStructCreate $tStruct2 : error " & @error, _ "Check AutoIt help file for this error") DllClose($hDLLSort) Return SetError(21, 0, 0) EndIf Local $sData = "", $sDelim = Chr(1) If $iDims = 1 Then ; 1D If $iType = 1 And $iRows > 1 And StringLeft(StringStripWS($aArray[1], 1), 2) = "0x" Then ; $STR_STRIPLEADING = 1 ; As row 0 may contain a count => better check "0x" at row 1 For $i = 0 To $iRows - 1 $sData &= Number(StringStripWS($aArray[$i], 1)) & $sDelim ; $sDelim also at end of string (used by dll +++) Next Else For $i = 0 To $iRows - 1 $sData &= $aArray[$i] & $sDelim Next EndIf Else ; 2D If $iType = 1 And $iRows > 1 And StringLeft(StringStripWS($aArray[1][$iSortCol], 1), 2) = "0x" Then For $i = 0 To $iRows - 1 $sData &= Number(StringStripWS($aArray[$i][$iSortCol], 1)) & $sDelim Next Else For $i = 0 To $iRows - 1 $sData &= $aArray[$i][$iSortCol] & $sDelim Next EndIf EndIf Local $aBackup = $aArray ; backup the array before the sort (needed below, extremely fast !) Local $aRet = DllCall($hDLLSort, "int:cdecl", "sortall", "wstr", $sData, "ptr", DllStructGetPtr($tStruct2), _ "wstr", $sDelim, "int", $iRows, "int", $iStable, "int", $iType) If @error Then MsgBox($MB_TOPMOST, "DllCall : error " & @error, _ "Check AutoIt help file for this error") $tStruct2 = 0 DllClose($hDLLSort) Return SetError(22, 0, 0) EndIf If $aRet[0] <> 0 Then Switch $aRet[0] Case - 1 ; as programmed in "sortall.dll" (Natural sort part) MsgBox($MB_TOPMOST, "Natural sort : error " & $aRet[0], _ "shlwapi.dll not found on your system") $tStruct2 = 0 DllClose($hDLLSort) Return SetError(23, 0, 0) Case - 2 ; as programmed in "sortall.dll" (Natural sort part) MsgBox($MB_TOPMOST, "Natural sort : error " & $aRet[0], _ "Function StrCmpLogicalW not found in shlwapi.dll") $tStruct2 = 0 DllClose($hDLLSort) Return SetError(24, 0, 0) Case Else ; no other error programmed (for now) in "sortall.dll", for any sort. MsgBox($MB_TOPMOST, "sortall.dll : impossible error " & $aRet[0], _ "This should never happen") $tStruct2 = 0 DllClose($hDLLSort) Return SetError(25, 0, 0) EndSwitch EndIf If $iDims = 1 Then ; 1D If $iSense = 0 Then ; ascending For $i = 1 To $iRows $aArray[$i - 1] = $aBackup[DllStructGetData($tStruct2, 1, $i)] Next Else ; descending For $i = 1 To $iRows $aArray[$iRows - $i] = $aBackup[DllStructGetData($tStruct2, 1, $i)] Next EndIf Else ; 2D Local $iIndex If $iSense = 0 Then ; ascending For $i = 1 To $iRows $iIndex = DllStructGetData($tStruct2, 1, $i) ; row index before sorting For $j = 0 To $iCols - 1 $aArray[$i - 1][$j] = $aBackup[$iIndex][$j] Next Next Else ; descending For $i = 1 To $iRows $iIndex = DllStructGetData($tStruct2, 1, $i) ; row index before sorting For $j = 0 To $iCols - 1 $aArray[$iRows - $i][$j] = $aBackup[$iIndex][$j] Next Next EndIf EndIf $tStruct2 = 0 ; release the resources used by the structure. DllClose($hDLLSort) Return 1 ; success EndFunc ;==>SortAll 3) "Test2.au3 #include <Array.au3> #include <SortAll.au3> ; pixelsearch's sortall.dll #include "RandomArray.au3" ; LarsJ Opt("MustDeclareVars", 1) Local $iRows = 100000, $iCols = 6, $aArray ; 6 related to _Generate_All() _Generate_All($aArray, $iRows, $iCols) _ArrayDisplay($aArray, "UNsorted", Default, Default, Default, _ "Strings|Integers*|Floats*|Dates*|Times*|R/C*") ; * at end of any header means numeric sort for the concerned column. ;==================================== Local $hTimer = TimerInit() Local $iSortCol = 0 ; (first column = 0) (value not important when 1D) Local $iType = 2 ; (0 = String sort, 1 = Numeric sort, 2/3 = Natural sort) Local $iSense = 0 ; (0 = ascending, 1 = descending) Local $iStable = 0 ; (0 = unstable sort, 1 = stable sort) Local $iRet = SortAll($aArray, $iSortCol, $iType, $iSense, $iStable) If $iRet Then ; 1 = success, 0 = fail with @error > 0 ConsoleWrite("Generating sorted 2D array = " & Int(TimerDiff($htimer)) & " ms" & @crlf) _ArrayDisplay($aArray, "sorted (col " & $iSortCol & ")", Default, Default, Default, _ "Strings|Integers*|Floats*|Dates*|Times*|R/C*") ; * at end of any header means numeric sort for the concerned column. EndIf ;==================================== Func _Generate_All(ByRef $aArray, $iRows, $iCols) ConsoleWrite("$iRows = " & $iRows & " $iCols = " & $iCols & @CRLF) ; $aArray = FAS_Random2DArrayAu3($iRows, "sifdtr", "abcdefghijklmnopqrstuvwxyz") $aArray = FAS_Random2DArrayAu3($iRows, "sifdtr", "abcdefghijklmnopqrstuvwxyz0123456789.") EndFunc ;==>_Generate_All Though all the above has nothing to do with _ArrayDisplay beta (which uses a virtual listview), I personally "linked" a part of it to _ArrayDisplay, so I can also sort in ArrayDisplay 10 times faster than the beta, when clicking on a column header to create the appropriate sort index. @jpm, in case you're interested, I'll present you by PM the code I added. Basically, in case of calling __ArrayDisplay_SortArrayStruct() to return the index (as in the original beta), I call a new function named __ArrayDisplay_SortArrayStruct2() to return the same index, through the dll. If for any reason the index can't be created (maybe the dll is missing), then there is an automatical transition to your function, so it looks safe. Any @error returned by __ArrayDisplay_SortArrayStruct2() will chain to the original function __ArrayDisplay_SortArrayStruct() . During my tests it didn't happen, I had to force errors to get the "smooth transition". Func __ArrayDisplay_GetSortColStruct(Const ByRef $aArray, $iCol) ... ;~ Return __ArrayDisplay_SortArrayStruct($aArray, $iCol) Local $tIndex = __ArrayDisplay_SortArrayStruct2($aArray, $iCol) If VarGetType($tIndex) = "DLLStruct" Then Return $tIndex Else ; any @error returned involving sortall.dll Return __ArrayDisplay_SortArrayStruct($aArray, $iCol) ; chain smoothly with jpm's original function EndIf EndFunc ;==>__ArrayDisplay_GetSortColStruct Thanks for reading and have a great day Edit: I forgot... hats off to the developer(s) who scripted DebugArrayDisplay. It helped me a lot, by copying the sorted data generated by the dll, place it in a text file a.txt Then a click on a column header to have it sorted again, but now through the original code of the beta, copying the new sorted data and placing it in a text file b.txt Finally comparing both text files a.txt and b.txt to make sure the sortings were correct. So bravo to anyone who was involved in the creation of DebugArrayDisplay Let's not forget LarsJ's "RandomArray.au3" which is a big help when tests are needed. Update: Feb 22, 2022 : * Default Sort type changed from Numeric to Natural * Fixed String sort involving Unicode characters * Stable Sort in C++ code (instead of Unstable Sort) * Only 1 DllCall in SortAll.au3 * Only 1 point of entry in SortAll.dll Update: Feb 26, 2022 : * Warning when sort requested and array got 0 row * Release the resources used by structure $tStruct2 Update: Mar 6, 2022 : * User can choose between C++ Unstable / Stable Sort (new parameter) Update: Mar 19, 2022 : * Added a 2nd way for Natural sorting (LarsJ's index creation adapted to C++) Update: Mar 10, 2023 : * Minor update in "SortAll.au3"
    1 point
  11. Hi all, a long time ago I wanted a comfortable tool to get information of a specified user in our active directory. After some searching I decided to create my own tool and "Userinfo" was born. displays all useful information about the user (retrieved from active directory) displays the PCs/NCs the user has (if this information can be retrieved from a database) displays the list of neighbours of the current user compares the active directoy groups of the selected user with another user unlock a locked account Feel free to adjust it to your needs Credits go to: Water for his excellent Active Directory UDF Ascend4nt for his Clipput.html Funkey for demonstrating how to check if a label is bold or not rasim for the example showing how to sort Listview Items DanyFirex for his Loga-Library. Included a modified version in the zip-File which also logs milliseconds. Update 2018-03-08: Release of v3.43. Changes from 2.80: ehrm, plenty. Multilanguage support is removed, but this version is translated to english. This time, the Zip file includes two versions: the stripped-down version, which uses only the active directory. This version should run out-of-the-box (hehe, a Domain is required. Wouldn't make much sense otherwise, would it?) the 'full' version. This needs to be adopted to your environment, because it requires some SQL Database connections to get information about the user's PC Update 2022-02-21: Release of v4.07 Changes: now the Userinfo uses waters excellent AD.UDF instead of some code of it improved interface lots of new abilities now uses the loga.udf to create a Logfile if started from scite or if the compiled exe ist launched with the /log parameter now there is not a stripped-down version and a "full version" of the code. Instead, before trying any database connection, the server to be queried is checked via ping. So the code should run out-of-the-box without changes, and you can edit the database queries to fit to your environment best regards, Marc Userinfo.zip userinfo_english v3.43.zip Userinfo 4.07.zip
    1 point
  12. Gianni

    Morse Code

    usaully, in real world, when you receive morse from a remote operator, he can also hear if you are transmitting something, so if you need to stop him, while he is transmitting, you can interrupt him by starting to transmit a sequence of dots ; when he hears the dot sequence he stops his transmission and waits to hear your request. Normally then you will broadcast something like this "PLS RPT AA word" (in morse code of course) which means Please Reapeat All After word, where word will be the last word you have received. (in morse there are a lot of abbreviations used to shorten words. there is also the so called Q code, where each group of 3 letters starting with the letter Q has a particular meaning ... and that meaning is the same in all the world) Absolutely do not write Morse signals on paper !! and even worse, not translating Morse signals written on paper. To learn Morse you must ONLY hear the Morse signals by listening to those signals with your hearing. Even if at first it seems too difficult, with "a lot" of training it will become automatic. Also, you don't have to read what you receive, you have to write on paper letter by letter while receiving morse signals without reading the meaning of what you are writing, in this way you have less chance of making mistakes You have to transmit with the Morse key while reading the letters in clear text (absolutely do not translate the letters into morse symbols on the sheet!) you have to do it mentally. With practice you will associate each letter with a "sound", the sound you hear when you receive that letter in Morse code. No Morse operator counts the dots and lines, but learns to recognize the particular sound emitted by the sequence of dots and lines of each letter. In fact, if you ask a Morse operator for example what the letter F in morse looks like, he will never tell you 2 points a line and a point, but will emit the sound of that letter by saying "ti ti taa ti" that is the "sound" for the F letter. You will never learn morse by counting the number of dots and letters, but you will learn it by listening to the "sound" emitted by the sequence of dots and lines of each letter numbers and punctuation marks.
    1 point
  13. 1 point
  14. For anyone else that needs this: This is the link to the attachment in the german forum. https://autoit.de/wcf/index.php?attachment/81316-dbf-rar/ I have also attached it to this post DBF.rar
    1 point
  15. Try this: ;Coded by UEZ 2013 -> This program requires AutoIt version 3.3.9.21 or higher! #include <GDIPlus.au3> #include <Memory.au3> _GDIPlus_Startup() Global $sFile = StringReplace(@AutoItExe, "autoit3.exe", "Examples\GUI\msoobe.jpg") Global $hImage = _GDIPlus_ImageLoadFromFile($sFile) Global $hBitmap = _GDIPlus_ImageResize($hImage, 10, 7) Global $bImage = _GDIPlus_StreamImage2BinaryString($hBitmap) ConsoleWrite("Error: " & @error & @LF) ConsoleWrite(BinaryLen($bImage) & @CRLF) MsgBox(0, "Binary", $bImage) _GDIPlus_ImageDispose($hImage) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() Func _GDIPlus_StreamImage2BinaryString($hBitmap, $sFormat = "JPG", $iQuality = 80, $bSave = False, $sFilename = @ScriptDir & "\Converted.jpg") ;coded by UEZ 2013 build 2014-01-25 (based on the code by Andreik) Local $sImgCLSID, $tGUID, $tParams, $tData Switch $sFormat Case "JPG" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) $tData = DllStructCreate("int Quality") DllStructSetData($tData, "Quality", $iQuality) ;quality 0-100 Local $pData = DllStructGetPtr($tData) $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) Case "PNG", "BMP", "GIF", "TIF" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) Case Else Return SetError(1, 0, 0) EndSwitch Local $hStream = _WinAPI_CreateStreamOnHGlobal() ;http://msdn.microsoft.com/en-us/library/ms864401.aspx If @error Then Return SetError(2, 0, 0) _GDIPlus_ImageSaveToStream($hBitmap, $hStream, DllStructGetPtr($tGUID), DllStructGetPtr($tParams)) If @error Then Return SetError(3, 0, 0) Local $hMemory = _WinAPI_GetHGlobalFromStream($hStream) ;http://msdn.microsoft.com/en-us/library/aa911736.aspx If @error Then Return SetError(4, 0, 0) Local $iMemSize = _MemGlobalSize($hMemory) If Not $iMemSize Then Return SetError(5, 0, 0) Local $pMem = _MemGlobalLock($hMemory) $tData = DllStructCreate("byte[" & $iMemSize & "]", $pMem) Local $bData = DllStructGetData($tData, 1) _WinAPI_ReleaseStream($hStream) ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms221473(v=vs.85).aspx _MemGlobalFree($hMemory) If $bSave Then Local $hFile = FileOpen($sFilename, 18) If @error Then Return SetError(6, 0, $bData) FileWrite($hFile, $bData) FileClose($hFile) EndIf Return $bData EndFunc ;==>_GDIPlus_StreamImage2BinaryString It will return a binary string which can be saved.
    1 point
  16. FIXED: Before I posted I should have just opened up the include. I used the internal function __Debug_ReportClose() for debug.au3 to close the window and stop the debug.
    1 point
  17. Hi, Thanks for such useful information Actually i am trying to remove some programs that are listed in the add/remove programs list Currently i am not able to get the number of programs available in the list and not able to search for a particular program Can you please help me on this ? I am using $iIndex=_GUICtrlListBox_FindInText($hListBox, "BaseTEST") to search for BaseTEST application in the lsit and thereby i want to click on that to remove Thanks , Rama
    1 point
×
×
  • Create New...