inferno123 Posted November 19, 2007 Posted November 19, 2007 Could anybody help me on removing items from array ($Result_Array). The items I want to remove are in $sub_array . Thank you for all your help The piece of code is: $phrase = "Security Update for Windows XP" Dim $sub_array[1][1] For $y = 0 To $Result_Array[$y][0] $element = $Result_Array[$y][0] $string = StringInStr($element, $phrase) If $string = 1 Then ;MsgBox(0, "", $element) ;_ArrayDelete($Result_Array,$element) _ArrayAdd($sub_array, $Result_Array[$y][0]) EndIf Next For $n = 1 To $sub_array[0] $search = _ArraySearch($Result_Array, $sub_array[$n]) If $search = 1 Then MsgBox(0, "", $search) _ArrayDelete($Result_Array, $search) EndIf Next
BrettF Posted November 19, 2007 Posted November 19, 2007 Look at _arrayAdd, _ArrayDelete and _ArraySearch... How is $result_array calculated? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
inferno123 Posted November 19, 2007 Author Posted November 19, 2007 $outFile1 = @TempDir & "\temp1.tmp" $outFile2 = @TempDir & "\temp2.tmp" $outFile3 = @TempDir & "\temp3.tmp" FileOpen($outFile2, 1) $strFile = "c:\Version.txt" $text_1 = FileRead($outFile2) $text_2 = FileRead($outFile1) Local $array_reg_values[1][1], $array_sub_values[1][1], $array_sub_values_Versions[1][1], $azbArray[1][1] Local $key = "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall" For $a = 1 To 1000 $reg_values = RegEnumKey($key, $a) If StringInStr($reg_values, "No more data is") = 0 Then _ArrayAdd($array_reg_values, $reg_values) EndIf Next $array_reg_values[0] = UBound($array_reg_values) - 1 For $b = 1 To $array_reg_values[0] $sub_key = "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall" & "\" & $array_reg_values[$b] $reg_sub_values = RegRead($sub_key, "DisplayName") _ArrayAdd($array_sub_values, $reg_sub_values) Next $array_sub_values[0] = UBound($array_sub_values) - 1 For $c = 1 To $array_sub_values[0] If $array_sub_values[$c] = "" Then $array_sub_values[$c] = $array_reg_values[$c] EndIf Next For $d = 1 To $array_sub_values[0] $sub_key = "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall" & "\" & $array_reg_values[$d] $reg_sub_values_versions = RegRead($sub_key, "DisplayVersion") _ArrayAdd($array_sub_values_Versions, $reg_sub_values_versions) Next _FileWriteFromArray($outFile2, $array_sub_values) Dim $Result_Array[uBound($array_sub_values) ][2] For $i = 0 To UBound($array_sub_values) - 1 $Result_Array[$i][0] = $array_sub_values[$i] $Result_Array[$i][1] = $array_sub_values_Versions[$i] ;->>> Joing arrays into single 2D array Next That is the $Result_array. I want to remove Security Updates string from Result Array. Is my approach to this array correct ?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now