Ok I have updated my script, this is so much better.

Using FSO.Files and FSO.SubFolders and then FileOwner to get ownership.

ProgressBar all working now, NO bugs found.

Works really fast.

 -




;    *********************************************************************************
;    * Script Name:        Display Owner of Files & Folders                         *
;    * Creator:        Richard Farthing - Queen Elizabeth Hospital NHS Trust        *
;    * Date:            1/09/03                                            *   
;    * Requirments        FileOwner Function, KiXforms v2.3.0 Beta 3,                * 
;    *                KiXtart 4.22 Beta 1                                    *
;    *********************************************************************************


Break On ; Break On to allow user to break out

;**********************************************************************************************************
;Checking that KiXtart Forms DLL is Registered
If NOT ReadValue("HKEY_CLASSES_ROOT\CLSID\{78F2E57A-21C9-467D-B20B-6836E9A36272}\InprocServer32""ThreadingModel") = "Both"
    MessageBox("KiXtart Forms Register DLL Failed, Please contact the IMT Helpdesk on x6049"
    "Displays Owner of Files & Folders - KiXtart Forms DLL Register Failed"0)
GoTo End
EndIf

;**********************************************************************************************************
$KiX = "D:\KiX" ; Set the KiX verable
Call $Kix+'\Functions\FileOwner().Kix' ; Calling the FileOwner() Function

;**********************************************************************************************************
;Type in the Drive Letters of the Shared Drive and the IMS Drive.

$FirstDrive = "C:\"
$SecondDrive = "D:\" ;Leave as "" if you do not want a second drive.

;**********************************************************************************************************
;Create Object to KiXtart Form
$FORM = CreateObject("Kixtart.Form")

;**********************************************************************************************************
;Main Form

$FORM.Caption                                = "Displays Owner of Files & Folders"
$FORM.ScaleHeight                            = 240
$FORM.ScaleWidth                            = 405
$FORM.FontSize                                = 8
$FORM.Center   

;**********************************************************************************************************
;Current Directory Label

$ListCurrentDir                            = $FORM.Label
$ListCurrentDir.Left                        = 5
$ListCurrentDir.Top                            = 30
$ListCurrentDir.Width                        = 380
$ListCurrentDir.Height                        = 20
$ListCurrentDir.FontSize                        = 8
$ListCurrentDir.FONTNAME                     = "Arial"
$ListCurrentDir.Enabled                        = 0

$lblCurrentDir                                = $FORM.Label("Current Folder: ")
$lblCurrentDir.Left                            = 5
$lblCurrentDir.Top                            = 15
$lblCurrentDir.Width                        = 120
$lblCurrentDir.Height                        = 20
$lblCurrentDir.FontSize                        = 8
$lblCurrentDir.FONTNAME                         = "Arial"
$lblCurrentDir.Enabled                        = 0

;**********************************************************************************************************
;ListView for OwnerList

$GetOwnerListBox                            = $FORM.Listview
$GetOwnerListBox.Left                        = 5
$GetOwnerListBox.Top                        = 55
$GetOwnerListBox.Width                        = 395
$GetOwnerListBox.Height                        = 160
$GetOwnerListBox.FontSize                    = 8
$GetOwnerListBox.FONTNAME                     = "Arial"
$GetOwnerListBox.View                         = 1
$GetOwnerListBox.SmallImageList                 = $Form.SmallImageList
$GetOwnerListBox.OnDoubleClick                = "ListView_DoubleClick()"
$=$GetOwnerListBox.Columns.Add("Name",250
$=$GetOwnerListBox.Columns.Add("Owner",125)
$FolderRoot = $FirstDrive

;**********************************************************************************************************
;Command Button for select Drive

If $SecondDrive
    $SelectDrive                                    = $FORM.CommandButton
    $SelectDrive.Left                                = 278
    $SelectDrive.Top                                = 7
    $SelectDrive.Width                                = 115
    $SelectDrive.Height                                = 20
    $SelectDrive.FontSize                            = 8
    $SelectDrive.FONTNAME                             = "Arial"
    $SelectDrive.Text                                = "Click to Browse "+$SecondDrive
    $SelectDrive.OnClick                            = "SelectDrive_Click()"
EndIf

;**********************************************************************************************************
;ProgressBar for DirList

$ProgressBar                                = $FORM.ProgressBar() 
$ProgressBar.Width                           = 300
$ProgressBar.Height                          = 15
$ProgressBar.Left                            = 50
$ProgressBar.Top                             = 220
$ProgressBar.Style                           = 2
$ProgressBar.Minimum                         = 0 
$ProgressBar.Enabled                         = 0

;**********************************************************************************************************
;Objects within Main Form

$FORM.Show ; Show Form

ListView() ; Call ListView Function

While $FORM.Visible
 $=Execute($FORM.DoEvents)
Loop
:End
Exit 1

;***********************************************************************************************************
;Call Functions & UDF's ****
;***********************************************************************************************************


;***********************************************************************************************************
;ListView Function

Function ListView()

Enabled(0; Call Enabled Function
$ListCurrentDir.Text = $FolderRoot ; Set Current Directory Label

$FSO = CreateObject("Scripting.FileSystemObject").GetFolder($FolderRoot)
$ProgressBar.Maximum = $FSO.SubFolders.Count + $FSO.Files.Count ; Set the maximum value of the ProgressBar to count of the Files and Folders Array
$=$GetOwnerListBox.Items.Add("..",47; Create Item for ".."           

$x = 1
;Folder Array
For Each $FolderListArray In $FSO.SubFolders
    $ProgressBar.Value = $x ; Set Value of ProgressBar to $x
    $Owner = Split(FileOwner($FolderListArray),"\";Split Object into an Array using "\"
    $=$GetOwnerListBox.Items.Add($FolderListArray.Name+"\",1;Add FolderName Item into Listview
    $GetOwnerListBox.Items($x).SubItems(1).Text = $Owner[Ubound($Owner)] ; Add Owner Item into ListView
    $x = $x + 1   
Next

;File Array
For Each $FileListArray In $FSO.Files
    $ProgressBar.Value = $x
    $Owner = Split(FileOwner($FileListArray),"\")
    $=$GetOwnerListBox.Items.Add($FileListArray.Name,0)
    $GetOwnerListBox.Items($x).SubItems(1).Text = $Owner[Ubound($Owner)] 
    $x = $x + 1   
Next

Enabled(1; Call the Enabled Function

EndFunction

;***********************************************************************************************************
;ListView Double Click Function

Function ListView_DoubleClick()
 
For Each $Item In $GetOwnerListBox.SelectedItems
    $ItemName = $Item.Text
    If $ItemName = ".." ; If ItemName = ".."
        If NOT $FolderRoot = SubStr($FolderRoot,1,2)+'\' ; If $FolderRoot does NOT Contain the 1st 2 charcters of FolderRoot
            $FolderRootSplit = Split($FolderRoot,"\"; Splits the FolderRoot into an Array on "\" charcter     
            ReDim PRESERVE $FolderRootSplit[Ubound($FolderRootSplit) -2; ReDim the FolderRootSplit Array and cut off the last 2 segments of the array but kee p the data
            $FolderRoot = Join($FolderRootSplit,"\")+'\' ; Re join the array and use "\" as the joining character
            $GetOwnerListBox.Items.Clear ; Clear the ListView of all Items
            ListView() ; Call the ListView Function
        EndIf
    Else
        If NOT InStr($ItemName,"\") = 0 ; If "\" is NOT in Selected ItemName
            $FolderRoot = $FolderRoot+"$ItemName" ; Set FolderRoot
            $GetOwnerListBox.Items.Clear ; Clear the ListView of all Items
            ListView() ; Call the ListView Function
        EndIf
    EndIf
Next   

EndFunction

;***********************************************************************************************************
;Set the FolderRoot Verable

Function SelectDrive_Click()

If SubStr($FolderRoot,1,3) = $FirstDrive 
    $FolderRoot = $SecondDrive
    $SelectDrive.Text = "Click to Browse "+$FirstDrive
Else
    $FolderRoot = $FirstDrive
    $SelectDrive.Text = "Click to Browse "+$SecondDrive
EndIf

$GetOwnerListBox.Items.Clear
ListView()

EndFunction

;***********************************************************************************************************
; Set the Enabled Function

Function Enabled($Option)
    $ProgressBar.Value = 0
    $GetOwnerListBox.Enabled = $Option

If $SelectDrive.Enabled = 0 OR $SelectDrive.Enabled = 1
     $SelectDrive.Enabled = $Option   
EndIf

EndFunction

;***********************************************************************************************************



[ 01. September 2003, 13:56: Message edited by: Richard Farthing ]