Jump to content
Chimaera

Having some trouble with Array Delete

Recommended Posts

Chimaera

Been trying to get array delete working but im getting exit codes of -1 - 3
Im not actually sure what an valid range string is?

#include <Date.au3> ; needed for _UninstallList function

; Examples ##########################################################################################################
#include <Array.au3> ; Just for _ArrayDisplay
Local $aList, $test
Global $sRemoveArray = 'Microsoft Office 32-bit Components 2013|Microsoft OneNote MUI (English) 2013'
; ==================================================
Global $aRemoveArray = StringSplit($sRemoveArray, "|")
;~ _ArrayDisplay($aRemoveArray, 'Total RemoveArray')
;~ =================================================
; Lists all keys , Both Quiet and normal uninstall
$aList = _UninstallList("UninstallString", ".+", "UninstallString|QuietUninstallString", 3, 3)
_ArrayDisplay($aList, "UninstallString", Default, Default, Default, "DisplayName|Date|RegistryPath|RegistrySubKey|UninstallString|QuietUninstallString")
        For $removeloop = 1 To $aRemoveArray[0]
            $test = _ArrayDelete($aList, $aRemoveArray[$removeloop])
            ConsoleWrite( $test & ' - ' & @error & @CRLF)
        Next
_ArrayDisplay($aList, "UninstallString", Default, Default, Default, "DisplayName|Date|RegistryPath|RegistrySubKey|UninstallString|QuietUninstallString")



;~ Local $sString = _ArrayToString($aList, ",", Default, Default, @CRLF) ; Make into .csv format Beta needed

;~ FileWrite(@ScriptDir & '\Logs\uninstall_logs\' & @OSVersion & ' ' & @UserName & ' ' & @MDAY & ' ' & @MON & ' ' & @MIN & ' ' & @SEC & '.csv', $sString)
;~ MsgBox(64, 'Key Capture Has Finished', @UserName & ' ' & @MDAY & ' ' & @MON & ' ' & @MIN & ' ' & @SEC & '.csv Created', 3)

; ###################################################################################################################

; #FUNCTION# ====================================================================================================================
; Name ..........: _UninstallList
; Description ...: Returns an array of matching uninstall keys from registry, with an optional filter
; Syntax ........: _UninstallList([$sValueName = ""[, $sFilter = ""[, $sCols = ""[, $iSearchMode = 0[,$ iArch = 3]]]]]])
; Parameters ....: $sValueName       - [optional] Registry value used for the filter.
;                                          Default is all keys ($sFilter do not operates).
;                  $sFilter          - [optional] String to search in $sValueName. Filter is not case sensitive.
;                  $sCols            - [optional] Additional values to retrieve. Use "|" to separate each value.
;                                          Each value adds a column in the returned array
;                  $iSearchMode      - [optional] Search mode. Default is 0.
;                                          0 : Match string from the start.
;                                          1 : Match any substring.
;                                          2 : Exact string match.
;                                          3 : $sFilter is a regular expression
;                  $iArch            - [optional] Registry keys to search in. Default is 3.
;                                          1 : x86 registry keys only
;                                          2 : x64 registry keys only
;                                          3 : both x86 and x64 registry keys
; Return values .: Returns a 2D array of registry keys and values :
;                      $array[0][0] : Number of keys
;                      $array[n][0] : Registry key path
;                      $array[n][1] : Registry subkey
;                      $array[n][2] : Display name
;                      $array[n][3] : Installation date (YYYYMMDD format)
;                      $array[n][4] : 1st additional value specified in $sCols (only if $sCols is set)
;                      $array[n][5] : 2nd additional value specified in $sCols (only if $sCols contains at least 2 entries)
;                      $array[n][x] : Nth additional value ...
; Author ........: jguinch
; ===============================================================================================================================
Func _UninstallList($sValueName = "", $sFilter = "", $sCols = "", $iSearchMode = 0, $iArch = 3)
    Local $sHKLMx86, $sHKLM64, $sHKCU = "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall"
    Local $aKeys[1] = [$sHKCU]
    Local $sDisplayName, $sSubKey, $sKeyDate, $sDate, $sValue, $iFound, $n, $aResult[1][4], $iCol
    Local $aCols[1] = [0]

    If Not IsInt($iArch) Or $iArch < 0 Or $iArch > 3 Then Return SetError(1, 0, 0)
    If Not IsInt($iSearchMode) Or $iSearchMode < 0 Or $iSearchMode > 3 Then Return SetError(1, 0, 0)

    $sCols = StringRegExpReplace(StringRegExpReplace($sCols, "(?i)(DisplayName|InstallDate)\|?", ""), "\|$", "")
    If $sCols <> "" Then $aCols = StringSplit($sCols, "|")

    If @OSArch = "X86" Then
        $iArch = 1
        $sHKLMx86 = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
    Else
        If @AutoItX64 Then
            $sHKLMx86 = "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
            $sHKLM64 = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
        Else
            $sHKLMx86 = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
            $sHKLM64 = "HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
        EndIf
    EndIf

    If BitAND($iArch, 1) Then
        ReDim $aKeys[UBound($aKeys) + 1]
        $aKeys[UBound($aKeys) - 1] = $sHKLMx86
    EndIf

    If BitAND($iArch, 2) Then
        ReDim $aKeys[UBound($aKeys) + 1]
        $aKeys[UBound($aKeys) - 1] = $sHKLM64
    EndIf


    For $i = 0 To UBound($aKeys) - 1
        $n = 1
        While 1
            $iFound = 1
            Local $aSubKey = _RegEnumKeyEx($aKeys[$i], $n)
            If @error Then ExitLoop

            $sSubKey = $aSubKey[0]
            $sKeyDate = StringRegExpReplace($aSubKey[1], "^(\d{4})/(\d{2})/(\d{2}).+", "$1$2$3")
            $sDisplayName = RegRead($aKeys[$i] & "\" & $sSubKey, "DisplayName")
            $sDate = RegRead($aKeys[$i] & "\" & $sSubKey, "InstallDate")
            If $sDate = "" Then $sDate = $sKeyDate

            If $sDisplayName <> "" Then
                If $sValueName <> "" Then
                    $iFound = 0
                    $sValue = RegRead($aKeys[$i] & "\" & $sSubKey, $sValueName)
                    If ($iSearchMode = 0 And StringInStr($sValue, $sFilter) = 1) Or _
                            ($iSearchMode = 1 And StringInStr($sValue, $sFilter)) Or _
                            ($iSearchMode = 2 And $sValue = $sFilter) Or _
                            ($iSearchMode = 3 And StringRegExp($sValue, $sFilter)) Then
                        $iFound = 1
                    EndIf
                EndIf

                If $iFound Then
                    ReDim $aResult[UBound($aResult) + 1][4 + $aCols[0]]
                    $aResult[UBound($aResult) - 1][0] = $sDisplayName
                    $aResult[UBound($aResult) - 1][1] = $sDate
;~                     $aResult[ UBound($aResult) - 1][2] = $aKeys[$i]
                    $aResult[UBound($aResult) - 1][2] = $sSubKey ; change back to 3 if keys enabled


                    For $iCol = 1 To $aCols[0]
                        $aResult[UBound($aResult) - 1][3 + $iCol] = RegRead($aKeys[$i] & "\" & $sSubKey, $aCols[$iCol])
                    Next
                EndIf
            EndIf

            $n += 1
        WEnd
    Next

    $aResult[0][0] = UBound($aResult) - 1
    Return $aResult
EndFunc   ;==>_UninstallList

; #FUNCTION# ====================================================================================================================
; Name ..........: _RegEnumKeyEx
; Description ...: Enumerates the subkeys of the specified open registry key. The function retrieves information about one subkey
;                  each time it is called.
; Syntax ........: _RegEnumKeyEx($sKey, $iInstance)
; Parameters ....: $sKey                - The registry key to read.
;                  $iInstance           - The 1-based key instance to retrieve.
; Return values .: Success              - A 1D array :
;                                          $aArray[0] = subkey name
;                                          $aArray[1] = time at which the enumerated subkey was last written
;                  Failure               - Returns 0 and set @eror to non-zero value
; Author ........: jguinch
; ===============================================================================================================================
Func _RegEnumKeyEx($sKey, $iInstance)
    If Not IsDeclared("KEY_WOW64_32KEY") Then Local Const $KEY_WOW64_32KEY = 0x0200
    If Not IsDeclared("KEY_WOW64_64KEY") Then Local Const $KEY_WOW64_64KEY = 0x0100
    If Not IsDeclared("KEY_ENUMERATE_SUB_KEYS") Then Local Const $KEY_ENUMERATE_SUB_KEYS = 0x0008

    If Not IsDeclared("tagFILETIME") Then Local Const $tagFILETIME = "struct;dword Lo;dword Hi;endstruct"

    Local $iSamDesired = $KEY_ENUMERATE_SUB_KEYS

    Local $iX64Key = 0, $sRootKey, $aResult[2]

    Local $sRoot = StringRegExpReplace($sKey, "\\.+", "")
    Local $sSubKey = StringRegExpReplace($sKey, "^[^\\]+\\", "")

    $sRoot = StringReplace($sRoot, "64", "")
    If @extended Then $iX64Key = 1

    If Not IsInt($iInstance) Or $iInstance < 1 Then Return SetError(2, 0, 0)

    Switch $sRoot
        Case "HKCR", "HKEY_CLASSES_ROOT"
            $sRootKey = 0x80000000
        Case "HKLM", "HKEY_LOCAL_MACHINE"
            $sRootKey = 0x80000002
        Case "HKCU", "HKEY_CURRENT_USER"
            $sRootKey = 0x80000001
        Case "HKU", "HKEY_USERS"
            $sRootKey = 0x80000003
        Case "HKCC", "HKEY_CURRENT_CONFIG"
            $sRootKey = 0x80000005
        Case Else
            Return SetError(1, 0, 0)
    EndSwitch

    If StringRegExp(@OSArch, "64$") Then
        If @AutoItX64 Or $iX64Key Then
            $iSamDesired = BitOR($iSamDesired, $KEY_WOW64_64KEY)
        Else
            $iSamDesired = BitOR($iSamDesired, $KEY_WOW64_32KEY)
        EndIf
    EndIf

    Local $aRetOPen = DllCall('advapi32.dll', 'long', 'RegOpenKeyExW', 'handle', $sRootKey, 'wstr', $sSubKey, 'dword', 0, 'dword', $iSamDesired, 'ulong_ptr*', 0)
    If @error Then Return SetError(@error, @extended, 0)
    If $aRetOPen[0] Then Return SetError(10, $aRetOPen[0], 0)

    Local $hKey = $aRetOPen[5]

    Local $tFILETIME = DllStructCreate($tagFILETIME)
    Local $lpftLastWriteTime = DllStructGetPtr($tFILETIME)

    Local $aRetEnum = DllCall('Advapi32.dll', 'long', 'RegEnumKeyExW', 'long', $hKey, 'dword', $iInstance - 1, 'wstr', "", 'dword*', 255, 'dword', "", 'ptr', "", 'dword', "", 'ptr', $lpftLastWriteTime)
    If Not IsArray($aRetEnum) Or $aRetEnum[0] <> 0 Then Return SetError(3, 0, 1)

    Local $tFILETIME2 = _Date_Time_FileTimeToLocalFileTime($lpftLastWriteTime)
    Local $localtime = _Date_Time_FileTimeToStr($tFILETIME2, 1)

    $aResult[0] = $aRetEnum[3]
    $aResult[1] = $localtime

    Return $aResult
EndFunc   ;==>_RegEnumKeyEx

Im trying to remove the items in the remove array from the array of uninstall programs before i make a csv out of it

The $alist array looks like this

111|||||
Adobe AIR|20140523|Adobe AIR||c:\Program Files (x86)\Common Files\Adobe AIR\Versions\1.0\Resources\Adobe AIR Updater.exe -arp:uninstall|
Adobe Flash Player 17 NPAPI|20150414|Adobe Flash Player NPAPI||C:\Windows\SysWOW64\Macromed\Flash\FlashUtil32_17_0_0_169_Plugin.exe -maintain plugin|
Adobe Shockwave Player 12.1|20150305|Adobe Shockwave Player||"C:\Windows\SysWOW64\Adobe\Shockwave 12\uninstaller.exe"|
Alt.Binz 0.39.4|20140315|Alt.Binz||C:\Program Files (x86)\Alt.Binz\uninst.exe|
AutoIt v3.3.12.0|20140630|AutoItv3||C:\Program Files (x86)\AutoIt3\Uninstall.exe|
AutoIt v3.3.13.19 (Beta)|20141102|AutoItv3beta||C:\Program Files (x86)\AutoIt3\Beta\Uninstall.exe|

All im trying to do is delete one complete line is the A line of the array matches the name in the remove array

Is it failing because the second array has more dimensions?

Edited by Chimaera

Share this post


Link to post
Share on other sites
AspirinJunkie

When you delete elements inside of an for-loop keep in mind, that the min and max value of the loop variable keeps the same over the whole loop time.

That means if you have an array with 10 elements, the loop will end at the 10th element. If you delete one element during the loop this leads to an erro because when the loop reaches the 10th element the array has now a size of only 9.

To prevent this change the loop direction - begin whith the last element and loop with "Step -1" to the beginning.

Edited by AspirinJunkie

Share this post


Link to post
Share on other sites
LarsJ

It's failing because _ArrayDelete takes the index (an integer) of the row to delete as second parameter. Not a row in another array.

Share this post


Link to post
Share on other sites
Melba23

Chimaera,

_ArrayDelete takes an index as the second parameter - as explained in the Help file this:

can be a single number or a range denoted by the first and last lines separated by a hyphen (-) - multiple items are separated by a semi-colon (;).

So valid parameters would be:

37 ; delete eleemnt [37]
25-29 ; Delete elements 25, 26, 27, 28, 29
11; 23; 45 ; Delete elements 11, 23, 45

It looks to me as if you are passing a string, not a number. If that is the case, you will need to search the array for the string and use the returned index to delete the element.

M23

 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Chimaera

Ok im at this now

$aList = _UninstallList("UninstallString", ".+", "UninstallString|QuietUninstallString", 3, 3)
_ArrayDisplay($aList, "UninstallString", Default, Default, Default, "DisplayName|Date|RegistryPath|RegistrySubKey|UninstallString|QuietUninstallString")
        For $removeloop = 1 To $aRemoveArray[0]
            $search = _ArraySearch($aList, $aRemoveArray[$removeloop])
            ConsoleWrite( $search & ' - ' & @error & ' - ' & $aRemoveArray[$removeloop] & @CRLF)
            $test = _ArrayDelete($aList, $search)
            ConsoleWrite( $test & ' - ' & @error & ' - ' & $aRemoveArray[$removeloop] & @CRLF)
        Next
_ArrayDisplay($aList, "UninstallString", Default, Default, Default, "DisplayName|Date|RegistryPath|RegistrySubKey|UninstallString|QuietUninstallString")

Is there a reason the second array display has less lines but the same count as the first one?

Share this post


Link to post
Share on other sites
Melba23

Chimaera,

Is there a reason the second array display has less lines but the same count as the first one?

Of course there is. The "count" element of an array is not affected by the _ArrayDelete call - and how would AutoIt know if there was a count element anyway? You have to reduce it yourself ($aList[0] -= 1).

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
iamtheky

could you  loop backwards (as is my habit when arraydelete is involved), and use ubound ignoring the count altogether?

For $removeloop = ubound($aRemoveArray) - 1 to 1 step -1

 

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
Melba23

Chimaera,

No, you just need to add the additional command inside the loop when you successfully remove an element:

For $removeloop = 1 To $aRemoveArray[0]
    $search = _ArraySearch($aList, $aRemoveArray[$removeloop])
    ; You might want to add some errorchecking here too <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ConsoleWrite( $search & ' - ' & @error & ' - ' & $aRemoveArray[$removeloop] & @CRLF)
    $test = _ArrayDelete($aList, $search)
    If Not @error Then
        $aList[0] -= 1 ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    EndIf

    ConsoleWrite( $test & ' - ' & @error & ' - ' & $aRemoveArray[$removeloop] & @CRLF)
Next

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
iamtheky

$aList[0] = ubound($alist)

at any point after the loop and before the array display


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
Melba23

boththose,

I think you are missing a " - 1 " in there.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Chimaera

Chimaera,

No, you just need to add the additional command inside the loop when you successfully remove an element:

For $removeloop = 1 To $aRemoveArray[0]
    $search = _ArraySearch($aList, $aRemoveArray[$removeloop])
    ; You might want to add some errorchecking here too <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ConsoleWrite( $search & ' - ' & @error & ' - ' & $aRemoveArray[$removeloop] & @CRLF)
    $test = _ArrayDelete($aList, $search)
    If Not @error Then
        $aList[0] -= 1 ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    EndIf

    ConsoleWrite( $test & ' - ' & @error & ' - ' & $aRemoveArray[$removeloop] & @CRLF)
Next

M23

​I tried something similar and i just tried that but it throws an errors at 

$aList[0] -= 1

 Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

Share this post


Link to post
Share on other sites
Melba23

Chimaera,

Then add some errorchecking to make sure that $aList is still an array - although as you are apparently deleting elements from it I cannot really see why it would not be.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
mikell

$aList is a 2D array, as returned by _UninstallList()  ;)

Share this post


Link to post
Share on other sites
Melba23

mikell,

Good catch.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Chimaera

Using Boththose idea going backwards it seems to working on the whole however i have found an oddity 

I have this for example in the ignore list

 Microsoft Office Professional Plus 2013

and the script completely ignores it, its in the array before the _arraydelete but its there after, i cant get my head around why the array delete would miss it
and its not the only one that gets overlooked ive found a few more since i noticed

$aList = _UninstallList("UninstallString", ".+", "UninstallString|QuietUninstallString", 3, 3)
_ArrayDisplay($aList, "UninstallString", Default, Default, Default, "DisplayName|Date|RegistryPath|RegistrySubKey|UninstallString|QuietUninstallString")
For $removeloop = UBound($aRemoveArray) - 1 To 1 Step -1 ;For $removeloop = 1 To $aRemoveArray[0]
    $search = _ArraySearch($aList, $aRemoveArray[$removeloop])
;~  ConsoleWrite($search & ' - ' & @error & ' - ' & $aRemoveArray[$removeloop] & @CRLF)
    $test = _ArrayDelete($aList, $search)
    Sleep(10)
;~  ConsoleWrite($test & ' - ' & @error & ' - ' & $aRemoveArray[$removeloop] & @CRLF)
Next
_ArrayDisplay($aList, "UninstallString", Default, Default, Default, "DisplayName|Date|RegistryPath|RegistrySubKey|UninstallString|QuietUninstallString")

Can anyone suggest why it would ignore certain ones in an array and not remove them? Is it because of the arraysearch? as i dont normally use that i normally just work through the whole array one at a time.

Edited by Chimaera

Share this post


Link to post
Share on other sites
mikell

$search = _ArraySearch($aList[2], $aRemoveArray[$removeloop])

doesn't seem to be the proper syntax to search in a 2D array...

Share this post


Link to post
Share on other sites
Chimaera

Sorry typo that was me messing about wondering if i could target column 2 and search for the uninstall names instead because they are more unique to solve the missing names issue

I didnt realise i had left that in 

    $search = _ArraySearch($aList, $aRemoveArray[$removeloop])

Edited by Chimaera

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.