Jump to content

_ArrayDisplay any other options?


Chimaera
 Share

Recommended Posts

I tried the example now ive got back to coding and it doesnt seem to work how i was expecting it.

Anyway i have had a rethink in order to simplify this code im going use just the count as the how many was removed and keep the arrays for the logfile of what was actually removed

So im here atm

Global $Deleted = "", $sRegKey = "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run"
   For $i = 1 To $aRegKeys[0]
    RegRead($sRegKey, $aRegKeys[$i])
    If @error = 0 Then
     RegDelete($sRegKey, $aRegKeys[$i])
     $Deleted &= $aRegKeys[$i] & "|"
     Sleep(100)
    EndIf
   Next
   $aHKLM_Run_Deleted = StringSplit($Deleted, "|")
   _ArrayDelete($aHKLM_Run_Deleted, 0)

The $aHKLM_Run_Deleted gets _ArrayConcatenate nearer the end of the script when i merge 7 of these together

So whats the best way to extract the count of how many out of that to give me a number for the gui?

Thanks for any suggestions

Chimaera

Edited by Chimaera
Link to comment
Share on other sites

lol this is where i went from all the suggestions in this thread and reading the helpfile, gimme a min ill knock summat up

Actually czardas was right, thats what you get for putting your code down for a while

ive got it showing a number now because i was looking at the wrong bit :graduated:

But ive no doubt i shall be back soon enough ;)

Edited by Chimaera
Link to comment
Share on other sites

There are often several ways to do things. The choice depends on the situation. This might be what you want, though I'm not entirely sure. It depends on how you write the rest of the code.

Global $Deleted = "", $sRegKey = "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run"
 
Local $iDeleteCount = 0 ; Increment variable.
For $i = 1 To $aRegKeys[0]
    RegRead($sRegKey, $aRegKeys[$i])
    If @error = 0 Then
        RegDelete($sRegKey, $aRegKeys[$i])
        $Deleted &= $aRegKeys[$i] & "|"
        ;Sleep(100)
    EndIf
Next
; The final delimiter needs removing.
$Deleted = StringTrimRight($Deleted, 1) ; You could avoid this by not adding it in the first place.
$aHKLM_Run_Deleted = StringSplit($Deleted, "|")
$iDeleteCount += $aHKLM_Run_Deleted[0] ; Add the count on each run before deleting element 0.
_ArrayDelete($aHKLM_Run_Deleted, 0)

What is it you are making BTW? You got me wondering.

Edited by czardas
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...