Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/16/2019 in all areas

  1. argumentum

    ListUserSessions

    ..was looking for UserName from SessionID so I put this together #include <Debug.au3> ; for _DebugArrayDisplay() ; all you can get from _WTSQuerySessionInformation() Global $i = _WTSQuerySessionInformation(-1, 4) ; current user's SessionId Global $__a_WTS_INFO_CLASS = StringSplit("WTSInitialProgram,WTSApplicationName,WTSWorkingDirectory,WTSOEMId,WTSSessionId,WTSUserName," & _ "WTSWinStationName,WTSDomainName,WTSConnectState,WTSClientBuildNumber,WTSClientName,WTSClientDirectory,WTSClientProductId,WTSClientHardwareId," & _ "WTSClientAddress,WTSClientDisplay,WTSClientProtocolType,WTSIdleTime,WTSLogonTime,WTSIncomingBytes,WTSOutgoingBytes,WTSIncomingFrames," & _ "WTSOutgoingFrames,WTSClientInfo,WTSSessionInfo,WTSSessionInfoEx,WTSConfigInfo,WTSValidationInfo,WTSSessionAddressV4,WTSIsRemoteSession", ",", 2) For $n = 0 To UBound($__a_WTS_INFO_CLASS) -1 ConsoleWrite($n & @TAB & StringLeft($__a_WTS_INFO_CLASS[$n] & ' ________________', 24) & " " & _WTSQuerySessionInformation($i, $n, 1) & @CRLF) Next Global $a = ListUserSessions() _DebugArrayDisplay($a, "ListUserSessions()") Func ListUserSessions() ; mod. of https://www.autoitscript.com/forum/topic/139774-dllcall-and-returned-pointers/?do=findComment&comment=980850 Local $_Self_SessionId = _WTSQuerySessionInformation(-1, 4) ; -1 = current user ; 4 = WTSSessionId Local Enum $e_IsSelf_SessionId, $e_SessionName, $e_UserName, $e_SessionId, $e_StateName, $e_StateInt, $e_ClientName, $e_ClientIp, $e_Domain, $e_UBound Local Const $tagWTS_SESSION_INFO = 'dword SessionId;ptr WinStationName;uint State' Local $aResult = DllCall('wtsapi32.dll', 'int', 'WTSEnumerateSessionsW', 'ptr', 0, 'dword', 0, 'dword', 1, 'ptr*', 0, 'dword*', 0) If @error Or $aResult[0] = 0 Then Return SetError(1, 0, "") ; https://docs.microsoft.com/en-us/windows/desktop/api/wtsapi32/ne-wtsapi32-_wts_connectstate_class Local $aConnectionState = StringSplit("Active,Connected,ConnectQuery,Shadow,Disconnected,Idle,Listen,Reset,Down,Init", ",", 2) Local $tInfo, $Offset = 0, $c = 0, $aReturn[$aResult[5] + 1][$e_UBound] ; $e_UBound is the last enumerator, just to determine the size of the array $aReturn[0][$e_SessionId] = "ID" $aReturn[0][$e_SessionName] = "SessionName" $aReturn[0][$e_StateInt] = "StateInt" $aReturn[0][$e_StateName] = "State" $aReturn[0][$e_UserName] = "UserName" $aReturn[0][$e_ClientName] = "ClientName" $aReturn[0][$e_ClientIp] = "ClientIp" $aReturn[0][$e_Domain] = "Domain" For $i = 1 To $aResult[5] $tInfo = DllStructCreate($tagWTS_SESSION_INFO, $aResult[4] + $Offset) $Offset += DllStructGetSize($tInfo) $c += 1 $aReturn[$c][$e_SessionId] = DllStructGetData($tInfo, 'SessionId') $aReturn[$c][$e_SessionName] = DllStructGetData(DllStructCreate('wchar[1024]', DllStructGetData($tInfo, 'WinStationName')), 1) $aReturn[$c][$e_StateInt] = DllStructGetData($tInfo, 'State') If UBound($aConnectionState) > $aReturn[$c][$e_StateInt] Then $aReturn[$c][$e_StateName] = $aConnectionState[$aReturn[$c][$e_StateInt]] $aReturn[$c][$e_UserName] = _WTSQuerySessionInformation($aReturn[$c][$e_SessionId], 5) ; WTSUserName $aReturn[$c][$e_ClientName] = _WTSQuerySessionInformation($aReturn[$c][$e_SessionId], 10) ; WTSClientName $aReturn[$c][$e_ClientIp] = _WTSQuerySessionInformation($aReturn[$c][$e_SessionId], 14) ; WTSClientAddress $aReturn[$c][$e_Domain] = _WTSQuerySessionInformation($aReturn[$c][$e_SessionId], 7) ; WTSDomainName $aReturn[0][$e_IsSelf_SessionId] = $c If $_Self_SessionId = $aReturn[$c][$e_SessionId] Then $aReturn[$c][$e_IsSelf_SessionId] = 1 Else $aReturn[$c][$e_IsSelf_SessionId] = 0 EndIf Next DllCall('wtsapi32.dll', 'none', 'WTSFreeMemory', 'ptr', $aResult[4]) Return $aReturn EndFunc ;==>ListUserSessions Func _WTSQuerySessionInformation($SessionId, $WTSInfoClass = 10, $iReturnAsIs = 0) ; mod. of https://www.autoitscript.com/forum/topic/134679-get-hostname-of-the-client-connected-to-the-terminalserver-session/ Local $aResult = DllCall("Wtsapi32.dll", "int", "WTSQuerySessionInformation", "Ptr", 0, "int", $SessionId, "int", $WTSInfoClass, "ptr*", 0, "dword*", 0) If @error Or $aResult[0] = 0 Then Return SetError(1, 0, "") Local $ip = DllStructGetData(DllStructCreate("byte[" & $aResult[5] & "]", $aResult[4]), 1) DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $aResult[4]) If $iReturnAsIs Then Return $ip Switch $WTSInfoClass ; https://docs.microsoft.com/en-us/windows/desktop/api/wtsapi32/ns-wtsapi32-_wts_client_address Case 4 ; WTSSessionId Return Int('0x' & StringTrimRight(StringReverse($ip), 3)) Case 14 ; WTSClientAddress If Not (Int(StringLeft($ip, 4)) = 2) Then ; IPv4 $ip = "" Else $ip = Dec(StringMid($ip, 15, 2)) & '.' & Dec(StringMid($ip, 17, 2)) & '.' & Dec(StringMid($ip, 19, 2)) & '.' & Dec(StringMid($ip, 21, 2)) EndIf EndSwitch Return StringReplace(BinaryToString($ip), Chr(0), "") EndFunc ;==>_GetWTSClientName
    1 point
  2. Here how I would do it (untested) : Local $GS_InitWinHdl = WinGetHandle("[ACTIVE]") ; Get the current ("Application Rules") Handle MouseClick( $MOUSE_CLICK_MAIN, 638, 168 ) ; Application Rules -> "Purge" Local $hTime = TimerInit () While WinGetHandle("[ACTIVE]") = $GS_InitWinHdl if TimerDiff($hTime) > 15 * 1000 then _MyUpdStatusMsg("Application Purge Timed Out") MsgBox($MB_OK, $GC_OurTitle, "FATAL: Application Purge Timed Out - Aborting") Exit -32 EndIf Sleep(200) Wend _MyUpdStatusMsg("Application Purge Button Wait Complete") Sleep( 1000 ) _MyUpdStatusMsg("Success - Exiting") MsgBox($MB_OK, $GC_OurTitle, "Success - Exiting") Exit 0 FYI : Global static are same as Global. It is usually used as Local Static. Use local (instead of global) as much as possible unless it is absolutely necessary.
    1 point
  3. WARNING: I'm going to simplify things in the text wall below. I won't discuss the actual mess between ADO, ODBC, OLE DB and I'll group all this under the term ADO. NOTE: ADO isn't always accessing a database. It goal is to provide high-level support to access data à la SQL. Said data might be a .CSV file, a filesystem, a bunch of industrial equipments, a relational (or not) DBMS, an Excel file, .. whatever. ADO objects, methods, properties are not supported nor managed nor implemented by the AUtoIt ADO UDF! All machinery resides inside the ADO DLL you use. @mLipok's UDF has very little room to "do everything for everybody". This AutoIt ADO UDF is -- like other AutoIt ADO UDFs -- just a relay between AutoIt coder and the specific ADO DLL (s) he selected to use, itself dictated by the choice of the DB engine or data source itself. There is zero possibility for this ADO.au3 to decide if object/method/property/parameter X is implemented or not in the DLL the coder uses. For instance, if method MoveFirst is not implemented in my_fancy_db_ado.dll there is no possibility for mLipok to substitute its own code. mLipok's UDF is generic (that's the whole purpose of ADO) and from its end, has zero knowledge about the guts inside the actual ADO DLL, which is dedicated to a particular DB engine. Hence, mLipok documentation can only describe the higher-level AutoIt functions offered by his UDF, then refer to an agnostic documentation (like the one from W3School already mentionned) for the description of full-fledged generic ADO, which may have full or partial support in a given my_fancy_db_ado.dll. As per adding functionality, I can't see how you can do that from outside the ADO DLL you use (for which you may not have source code). Don't think "AutoItObject.au3": this is stuff to create your own objects, not expand functionality of objects implemented in a separate DLL. To illustrate the inability of an AutoIt ADO UDF to work as you would want it to, consider the following SQL statement: with recursive Rnd (n, x) as ( values(1, Random()) union all select n+1, Random() from Rnd where n < 10 ) select n, x from Rnd; In your AutoIt code, you connect to some DB managed by engine YYY, using a DLL DDD you designate. Then you invoke mLipok's ADO Execute function with this SQL statement; this yields a RecordSet object RRR. With RRR you read a number of rows using RRR.Movenext method (remember the RRR methods reside inside the DDD dll, so is beyond your control as well as mLipok's control). At some point right in the middle or at EOF, you invoke method RRR.MoveFirst to re-read from the first row. If this method isn't fully implemented in DDD how do you think mLipok can do it for you? Even without a CTE (recursive or not), even without the non-determinism of Random() I used above, just think of a very simple plain select statement. In the middle of a number of .MoveNext, you invoke .MoveFirst and say that the ADO dll you use doesn't support it. The AutoIt ADO layer (wrapper) might store rows on the fly at each .MoveNext invokation so it would be theoritically possible to process .MoveFirst by its own. But then, it would have to intercept and process by itself any subsequent change in cursor position, because the cursor inside the DLL is still pointing to the position it had before it processed your .MoveFirst and it would need to intercept .BOF, .EOF, ... as well and do the job of the DLL because of the loss of sync in the recordset between old DLL cursor and AutoIt ADO cursor. Another point: you can't just re-issue the select statement because even if you could (a very big IF and you don't even have the right to do so at any rate), SQL makes no assumption about the order the rows fed to a recordset when an order clause by isn't specified. It's uncommon for a DB engine to provide rows in a varying order when a select is issued twice in a row, but it would be perfectly legitimate to do so, for instance, to make best use of some cache. If you intend to process .MoveFirst (or its friends) outside the DLL, how would you do? I hope this clarifies who does what. Thanks for your patience!
    1 point
  4. Melba23

    Recursive _ArraySort

    corgano, It was a design decision to place the files in the root folder first - and not that difficult to change them to the end. Does this modified function do what you want? #include <File.au3> #include <Array.au3> ; New constants for File.au3 Global $FLTAR_FILESFIRST = 1, $FLTAR_FILESLAST = 0 $aArray = _FileListToArrayRec_Mod("M:\Program\Au3 Scripts\Forum Help Scripts\", "*", $FLTAR_FILESFOLDERS, $FLTAR_RECUR, $FLTAR_FASTSORT, $FLTAR_RELPATH, $FLTAR_FILESFIRST) _ArrayDisplay($aArray, "", Default, 8) $aArray = _FileListToArrayRec_Mod("M:\Program\Au3 Scripts\Forum Help Scripts\", "*", $FLTAR_FILESFOLDERS, $FLTAR_RECUR, $FLTAR_FASTSORT, $FLTAR_RELPATH, $FLTAR_FILESLAST) _ArrayDisplay($aArray, "", Default, 8) Func _FileListToArrayRec_Mod($sFilePath, $sMask = "*", $iReturn = $FLTAR_FILESFOLDERS, $iRecur = $FLTAR_NORECUR, $iSort = $FLTAR_NOSORT, $iReturnPath = $FLTAR_RELPATH, $iFilesFirst = $FLTAR_FILESFIRST) If Not FileExists($sFilePath) Then Return SetError(1, 1, "") ; Check for Default keyword If $sMask = Default Then $sMask = "*" If $iReturn = Default Then $iReturn = $FLTAR_FILESFOLDERS If $iRecur = Default Then $iRecur = $FLTAR_NORECUR If $iSort = Default Then $iSort = $FLTAR_NOSORT If $iReturnPath = Default Then $iReturnPath = $FLTAR_RELPATH If $iFilesFirst = Default Then $iFilesFirst = $FLTAR_FILESFIRST ; Check for valid recur value If $iRecur > 1 Or Not IsInt($iRecur) Then Return SetError(1, 6, "") Local $bLongPath = False ; Check for valid path If StringLeft($sFilePath, 4) == "\\?\" Then $bLongPath = True EndIf Local $sFolderSlash = "" ; Check if folders should have trailing \ and ensure that initial path does have one If StringRight($sFilePath, 1) = "\" Then $sFolderSlash = "\" Else $sFilePath = $sFilePath & "\" EndIf Local $asFolderSearchList[100] = [1] ; Add path to folder search list $asFolderSearchList[1] = $sFilePath Local $iHide_HS = 0, _ $sHide_HS = "" ; Check for H or S omitted If BitAND($iReturn, $FLTAR_NOHIDDEN) Then $iHide_HS += 2 $sHide_HS &= "H" $iReturn -= $FLTAR_NOHIDDEN EndIf If BitAND($iReturn, $FLTAR_NOSYSTEM) Then $iHide_HS += 4 $sHide_HS &= "S" $iReturn -= $FLTAR_NOSYSTEM EndIf Local $iHide_Link = 0 ; Check for link/junction omitted If BitAND($iReturn, $FLTAR_NOLINK) Then $iHide_Link = 0x400 $iReturn -= $FLTAR_NOLINK EndIf Local $iMaxLevel = 0 ; If required, determine \ count for max recursive level setting If $iRecur < 0 Then StringReplace($sFilePath, "\", "", 0, $STR_NOCASESENSEBASIC) $iMaxLevel = @extended - $iRecur EndIf Local $sExclude_List = "", $sExclude_List_Folder = "", $sInclude_List = "*" ; Check mask parameter Local $aMaskSplit = StringSplit($sMask, "|") ; Check for multiple sections and set values Switch $aMaskSplit[0] Case 3 $sExclude_List_Folder = $aMaskSplit[3] ContinueCase Case 2 $sExclude_List = $aMaskSplit[2] ContinueCase Case 1 $sInclude_List = $aMaskSplit[1] EndSwitch Local $sInclude_File_Mask = ".+" ; Create Include mask for files If $sInclude_List <> "*" Then If Not __FLTAR_ListToMask($sInclude_File_Mask, $sInclude_List) Then Return SetError(1, 2, "") EndIf Local $sInclude_Folder_Mask = ".+" ; Set Include mask for folders Switch $iReturn Case 0 ; Folders affected by mask if not recursive Switch $iRecur Case 0 ; Folders match mask for compatibility $sInclude_Folder_Mask = $sInclude_File_Mask EndSwitch Case 2 ; Folders affected by mask $sInclude_Folder_Mask = $sInclude_File_Mask EndSwitch Local $sExclude_File_Mask = ":" ; Create Exclude List mask for files If $sExclude_List <> "" Then If Not __FLTAR_ListToMask($sExclude_File_Mask, $sExclude_List) Then Return SetError(1, 3, "") EndIf Local $sExclude_Folder_Mask = ":" ; Create Exclude mask for folders If $iRecur Then If $sExclude_List_Folder Then If Not __FLTAR_ListToMask($sExclude_Folder_Mask, $sExclude_List_Folder) Then Return SetError(1, 4, "") EndIf ; If folders only If $iReturn = 2 Then ; Folders affected by normal mask $sExclude_Folder_Mask = $sExclude_File_Mask EndIf Else ; Folders affected by normal mask $sExclude_Folder_Mask = $sExclude_File_Mask EndIf ; Verify other parameters If Not ($iReturn = 0 Or $iReturn = 1 Or $iReturn = 2) Then Return SetError(1, 5, "") If Not ($iSort = 0 Or $iSort = 1 Or $iSort = 2) Then Return SetError(1, 7, "") If Not ($iReturnPath = 0 Or $iReturnPath = 1 Or $iReturnPath = 2) Then Return SetError(1, 8, "") If Not ($iFilesFirst = 0 Or $iFilesFirst = 1) Then Return SetError(1, 9, "") ; Prepare for DllCall if required If $iHide_Link Then Local $tFile_Data = DllStructCreate("struct;align 4;dword FileAttributes;uint64 CreationTime;uint64 LastAccessTime;uint64 LastWriteTime;" & _ "dword FileSizeHigh;dword FileSizeLow;dword Reserved0;dword Reserved1;wchar FileName[260];wchar AlternateFileName[14];endstruct") Local $hDLL = DllOpen('kernel32.dll'), $aDLL_Ret EndIf Local $asReturnList[100] = [0] Local $asFileMatchList = $asReturnList, $asRootFileMatchList = $asReturnList, $asFolderMatchList = $asReturnList Local $bFolder = False, _ $hSearch = 0, _ $sCurrentPath = "", $sName = "", $sRetPath = "" Local $iAttribs = 0, _ $sAttribs = '' Local $asFolderFileSectionList[100][2] = [[0, 0]] ; Search within listed folders While $asFolderSearchList[0] > 0 ; Set path to search $sCurrentPath = $asFolderSearchList[$asFolderSearchList[0]] ; Reduce folder search list count $asFolderSearchList[0] -= 1 ; Determine return path to add to file/folder name Switch $iReturnPath ; Case 0 ; Name only ; Leave as "" Case 1 ;Relative to initial path $sRetPath = StringReplace($sCurrentPath, $sFilePath, "") Case 2 ; Full path If $bLongPath Then $sRetPath = StringTrimLeft($sCurrentPath, 4) Else $sRetPath = $sCurrentPath EndIf EndSwitch ; Get search handle - use code matched to required listing If $iHide_Link Then ; Use DLL code $aDLL_Ret = DllCall($hDLL, 'handle', 'FindFirstFileW', 'wstr', $sCurrentPath & "*", 'struct*', $tFile_Data) If @error Or Not $aDLL_Ret[0] Then ContinueLoop EndIf $hSearch = $aDLL_Ret[0] Else ; Use native code $hSearch = FileFindFirstFile($sCurrentPath & "*") ; If folder empty move to next in list If $hSearch = -1 Then ContinueLoop EndIf EndIf ; If sorting files and folders with paths then store folder name and position of associated files in list If $iReturn = 0 And $iSort And $iReturnPath Then __FLTAR_AddToList($asFolderFileSectionList, $sRetPath, $asFileMatchList[0] + 1) EndIf $sAttribs = '' ; Search folder - use code matched to required listing While 1 ; Use DLL code If $iHide_Link Then ; Use DLL code $aDLL_Ret = DllCall($hDLL, 'int', 'FindNextFileW', 'handle', $hSearch, 'struct*', $tFile_Data) ; Check for end of folder If @error Or Not $aDLL_Ret[0] Then ExitLoop EndIf ; Extract data $sName = DllStructGetData($tFile_Data, "FileName") ; Check for .. return - only returned by the DllCall If $sName = ".." Then ContinueLoop EndIf $iAttribs = DllStructGetData($tFile_Data, "FileAttributes") ; Check for hidden/system attributes and skip if found If $iHide_HS And BitAND($iAttribs, $iHide_HS) Then ContinueLoop EndIf ; Check for link attribute and skip if found If BitAND($iAttribs, $iHide_Link) Then ContinueLoop EndIf ; Set subfolder flag $bFolder = False If BitAND($iAttribs, 16) Then $bFolder = True EndIf Else ; Reset folder flag $bFolder = False ; Use native code $sName = FileFindNextFile($hSearch, 1) ; Check for end of folder If @error Then ExitLoop EndIf $sAttribs = @extended ; Check for folder If StringInStr($sAttribs, "D") Then $bFolder = True EndIf ; Check for Hidden/System If StringRegExp($sAttribs, "[" & $sHide_HS & "]") Then ContinueLoop EndIf EndIf ; If folder then check whether to add to search list If $bFolder Then Select Case $iRecur < 0 ; Check recur depth StringReplace($sCurrentPath, "\", "", 0, $STR_NOCASESENSEBASIC) If @extended < $iMaxLevel Then ContinueCase ; Check if matched to masks EndIf Case $iRecur = 1 ; Full recur If Not StringRegExp($sName, $sExclude_Folder_Mask) Then ; Add folder unless excluded __FLTAR_AddToList($asFolderSearchList, $sCurrentPath & $sName & "\") EndIf ; Case $iRecur = 0 ; Never add ; Do nothing EndSelect EndIf If $iSort Then ; Save in relevant folders for later sorting If $bFolder Then If StringRegExp($sName, $sInclude_Folder_Mask) And Not StringRegExp($sName, $sExclude_Folder_Mask) Then __FLTAR_AddToList($asFolderMatchList, $sRetPath & $sName & $sFolderSlash) EndIf Else If StringRegExp($sName, $sInclude_File_Mask) And Not StringRegExp($sName, $sExclude_File_Mask) Then ; Select required list for files If $sCurrentPath = $sFilePath Then __FLTAR_AddToList($asRootFileMatchList, $sRetPath & $sName) Else __FLTAR_AddToList($asFileMatchList, $sRetPath & $sName) EndIf EndIf EndIf Else ; Save directly in return list If $bFolder Then If $iReturn <> 1 And StringRegExp($sName, $sInclude_Folder_Mask) And Not StringRegExp($sName, $sExclude_Folder_Mask) Then __FLTAR_AddToList($asReturnList, $sRetPath & $sName & $sFolderSlash) EndIf Else If $iReturn <> 2 And StringRegExp($sName, $sInclude_File_Mask) And Not StringRegExp($sName, $sExclude_File_Mask) Then __FLTAR_AddToList($asReturnList, $sRetPath & $sName) EndIf EndIf EndIf WEnd ; Close current search If $iHide_Link Then DllCall($hDLL, 'int', 'FindClose', 'ptr', $hSearch) Else FileClose($hSearch) EndIf WEnd ; Close the DLL if needed If $iHide_Link Then DllClose($hDLL) EndIf ; Sort results if required If $iSort Then Switch $iReturn Case 2 ; Folders only ; Check if any folders found If $asFolderMatchList[0] = 0 Then Return SetError(1, 9, "") ; Correctly size folder match list ReDim $asFolderMatchList[$asFolderMatchList[0] + 1] ; Copy size folder match array $asReturnList = $asFolderMatchList ; Simple sort list __ArrayDualPivotSort($asReturnList, 1, $asReturnList[0]) Case 1 ; Files only ; Check if any files found If $asRootFileMatchList[0] = 0 And $asFileMatchList[0] = 0 Then Return SetError(1, 9, "") If $iReturnPath = 0 Then ; names only so simple sort suffices ; Combine file match lists __FLTAR_AddFileLists($asReturnList, $asRootFileMatchList, $asFileMatchList) ; Simple sort combined file list __ArrayDualPivotSort($asReturnList, 1, $asReturnList[0]) Else ; Combine sorted file match lists __FLTAR_AddFileLists($asReturnList, $asRootFileMatchList, $asFileMatchList, 1) EndIf Case 0 ; Both files and folders ; Check if any root files or folders found If $asRootFileMatchList[0] = 0 And $asFolderMatchList[0] = 0 Then Return SetError(1, 9, "") If $iReturnPath = 0 Then ; names only so simple sort suffices ; Combine file match lists __FLTAR_AddFileLists($asReturnList, $asRootFileMatchList, $asFileMatchList) ; Set correct count for folder add $asReturnList[0] += $asFolderMatchList[0] ; Resize and add file match array ReDim $asFolderMatchList[$asFolderMatchList[0] + 1] _ArrayConcatenate($asReturnList, $asFolderMatchList, 1) ; Simple sort final list __ArrayDualPivotSort($asReturnList, 1, $asReturnList[0]) Else ; Size return list Local $asReturnList[$asFileMatchList[0] + $asRootFileMatchList[0] + $asFolderMatchList[0] + 1] $asReturnList[0] = $asFileMatchList[0] + $asRootFileMatchList[0] + $asFolderMatchList[0] ; Sort root file list __ArrayDualPivotSort($asRootFileMatchList, 1, $asRootFileMatchList[0]) ; Set insertion index Local $iNextInsertionIndex = 1 If $iFilesFirst = 1 Then ; Add the sorted root files at the beginning For $i = 1 To $asRootFileMatchList[0] $asReturnList[$iNextInsertionIndex] = $asRootFileMatchList[$i] $iNextInsertionIndex += 1 Next EndIf ; Sort folder list __ArrayDualPivotSort($asFolderMatchList, 1, $asFolderMatchList[0]) Local $sFolderToFind = "" ; Work through folder list For $i = 1 To $asFolderMatchList[0] ; Add folder to return list $asReturnList[$iNextInsertionIndex] = $asFolderMatchList[$i] $iNextInsertionIndex += 1 ; Format folder name for search If $sFolderSlash Then $sFolderToFind = $asFolderMatchList[$i] Else $sFolderToFind = $asFolderMatchList[$i] & "\" EndIf Local $iFileSectionEndIndex = 0, $iFileSectionStartIndex = 0 ; Find folder in FolderFileSectionList For $j = 1 To $asFolderFileSectionList[0][0] ; If found then deal with files If $sFolderToFind = $asFolderFileSectionList[$j][0] Then ; Set file list indexes $iFileSectionStartIndex = $asFolderFileSectionList[$j][1] If $j = $asFolderFileSectionList[0][0] Then $iFileSectionEndIndex = $asFileMatchList[0] Else $iFileSectionEndIndex = $asFolderFileSectionList[$j + 1][1] - 1 EndIf ; Sort files if required If $iSort = 1 Then __ArrayDualPivotSort($asFileMatchList, $iFileSectionStartIndex, $iFileSectionEndIndex) EndIf ; Add files to return list For $k = $iFileSectionStartIndex To $iFileSectionEndIndex $asReturnList[$iNextInsertionIndex] = $asFileMatchList[$k] $iNextInsertionIndex += 1 Next ExitLoop EndIf Next Next If $iFilesFirst = 0 Then ; Add the sorted root files at the end For $i = 1 To $asRootFileMatchList[0] $asReturnList[$iNextInsertionIndex] = $asRootFileMatchList[$i] $iNextInsertionIndex += 1 Next EndIf EndIf EndSwitch Else ; No sort ; Check if any file/folders have been added If $asReturnList[0] = 0 Then Return SetError(1, 9, "") ; Remove any unused return list elements from last ReDim ReDim $asReturnList[$asReturnList[0] + 1] EndIf Return $asReturnList EndFunc ;==>_FileListToArrayRec_Mod If so, we might consider a formal modification to the UDF to make the order user-selectable using a new parameter. M23
    1 point
  5. Use the known handles of the windows, to compare to the current "[ACTIVE]" window...
    1 point
  6. Each item is identified by a key property named EntryID: https://docs.microsoft.com/de-de/office/vba/api/outlook.mailitem.entryid
    1 point
  7. Yes... I would complain on their site if I were you. Jos
    1 point
  8. According as @Bilgus suggested, "#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7" was added at the top of the code and all ensuing errors were corrected. Most of the errors were related with lack of keyword "Local" before assigning value to a local variable, and it seemed to be purely a matter of good coding practice. I'm glad I learned this though.
    1 point
  9. so... what did you try for yourself?
    1 point
  10. if you want the data to stay encrypted why can't you just encrypt the data prior to iniWrite and decrypt with iniRead? ;Pseudo Code Local $Data = _Crypt_EncryptData("PA55W0RD", $g_hKey, $CALG_USERKEY) IniWrite ( "filename", "Test", "supersecretkey", $Data ) Local $Decrypted = _Crypt_DecryptData(IniRead ( "filename", "Test", "supersecretkey", "0" ), $g_hKey, $CALG_USERKEY) ; Decrypt the text with the new cryptographic key. Local $ReadData = BinaryToString($Decrypted)
    1 point
  11. This is an old article and you may have to update the UDF scripts to make work with the latest AutoIt. Ini in Memory
    1 point
  12. MilenP, As the author of the UDF I can quite confidently state that the UDF can only set the edit status of columns - not rows. And if you have questions about the UDF, why not post in the UDF thread rather then asking the general community? M23
    1 point
  13. Hit Insert on your keyboard?
    1 point
×
×
  • Create New...