Jump to content

Numbering getting jacked up


Recommended Posts

my numbering does the following:

1

10

11

12

13

13

14

2

3

4

5

6

7

8

9

How can I fix this?

#include <Array.au3>
#include <File.au3>
#include <GuiConstantsEx.au3>
#include <Misc.au3>
#Include <GuiButton.au3>

_Singleton("FileChecker")

; #########################################################################################
; # Create GUI
; #########################################################################################

GUICreate("File Checker", 300, 300)
GUISetBkColor(0xFFFFFFFF)

; PROGRESS

$progress = 0

$progressbar = GuiCtrlCreateProgress(60, 10, 210, 20)
GuiCtrlSetData($progressbar, $progress)
$label = GuiCtrlCreateLabel("Progress:", 5, 15)
$label2 = GUICtrlCreateLabel("File Extentions that failed:", 15, 40)
$ExtList = GUICtrlCreateList("", 10, 60, 280, 200)
$finishedButton = GUICtrlCreateButton("Finished", 120, 260, 60)
GuiSetState(@SW_SHOW)



; #########################################################################################
; # GUI Events
; #########################################################################################

Opt("GUIOnEventMode",1)
GUISetOnEvent ($GUI_EVENT_CLOSE, "Close")
GUICtrlSetOnEvent ($GUI_EVENT_CLOSE, "Finished")


Func Finished()
    Exit
EndFunc

Func Close()
    Exit
EndFunc

; ########################################################################################
; # Check Open Restricted File Type Properties
; ########################################################################################

$checker1 = ""
$checker2 = ""
$listOfFails = ""
$y = 0
$z = 0

;set keys to check
$EditFlags = "EditFlags"
$AlwaysShowExt = "AlwaysShowExt"

;set path
$RegPath = "HKEY_LOCAL_MACHINE\Software\Classes\"

Local $keyArray[50]

;set rest of path
$keyArray[0] = "AcroExch.Document"
$keyArray[1] = "PowerPoint.Show.8"
$keyArray[2] = "AcroExch.FDFDoc"
$keyArray[3] = "AcroExch.XFDFDoc"
$keyArray[4] = "PowerPoint.SlideShow.8"
$keyArray[5] = "lslfile"
$keyArray[6] = "PowerPoint.Template.8"
$keyArray[7] = "lsofile"
$keyArray[8] = "Word.Backup.8"
$keyArray[9] = "htafile"
$keyArray[10] = "JSfile"
$keyArray[11] = "JSEfile"
$keyArray[12] = "FirefoxHTML"           
$keyArray[13] = "lssfile"
$keyArray[14] = "Word.document.8"



For $x = 0 To $keyArray
    
    $checker1 = RegRead($RegPath & $keyArray[$z], $EditFlags)
    
    If @error Or $checker1 <> 0 Then
        $y = $y+1
        $listOfFails = $y & " : " & $keyArray[$z] & " : " & $EditFlags
        $progress = $progress + 2
        GUICtrlSetData($ExtList, $listOfFails)
        GuiCtrlSetData($progressbar, $progress)
    EndIf
    
    $checker2 = RegRead($RegPath & $keyArray[$z], $AlwaysShowExt)
    
    If @error Or $AlwaysShowExt = "" Then
        $y = $y+1
        $listOfFails = $y & " : " & $keyArray[$z] & " : " & $AlwaysShowExt
        $progress = $progress + 2
        GUICtrlSetData($ExtList, $listOfFails)
        GuiCtrlSetData($progressbar, $progress)
    EndIf
    $z = $z+1
Next

$progress = 100

GuiCtrlSetData($progressbar, $progress)

; ########################################################################################
; # Keep GUI Alive
; ########################################################################################

 While 1
    sleep(50)
 Wend
Link to comment
Share on other sites

  • Moderators

HumperHard,

You create your list control with the default styles, which according to the ever useful help file are: "$LBS_SORT, $WS_BORDER, $WS_VSCROLL". So your data is always sorted alphabetically (in computer terms!) as you have found out.

If you changed your creation line to read:

$ExtList = GUICtrlCreateList("", 10, 60, 280, 200, BitOR($WS_BORDER, $WS_VSCROLL))

you should see a more normal (to our eyes at least!) numbering order.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

HumperHard,

You create your list control with the default styles, which according to the ever useful help file are: "$LBS_SORT, $WS_BORDER, $WS_VSCROLL". So your data is always sorted alphabetically (in computer terms!) as you have found out.

If you changed your creation line to read:

$ExtList = GUICtrlCreateList("", 10, 60, 280, 200, BitOR($WS_BORDER, $WS_VSCROLL))

you should see a more normal (to our eyes at least!) numbering order.

M23

I included the <ListBoxConstants.au3> and added the above code to my script but I am getting errors stating that $WS_BORDER: possibly used before declaration.
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...