Hi--

Again, thank you for the detail in taking me through this. I really
appreciate it!

Ok, so here's my first question. If I replace your default locations with
SelectFolder, can I get two different folders into their correct variables,
or will one supercede the other?

Here's my thought:

  sourceFolder = SelectFolder()
  if sourceFolder = nil then return
  sourceCount = sourceFolder.Count
  
  targetFolder = SelectFolder()
  if targetFolder = nil then return
  targetCount = targetFolder.Count

Would this work for the next set of instructions? If not, can a number be
assigned to these commands, such as:

  sourceFolder = SelectFolder(1)
  if sourceFolder = nil then return
  sourceCount = sourceFolder.Count
  
  targetFolder = SelectFolder(2)
  if targetFolder = nil then return
  targetCount = targetFolder.Count

Or are the () only to signify a Function?

All My Best,
Jeffrey


on 3/18/06 7:30 AM, "RBNUBE" <[EMAIL PROTECTED]> wrote:

> Message: 18
> Subject: RE: List of all files and folders for a given volume
> From: "RBNUBE" <[EMAIL PROTECTED]>
> Date: Sat, 18 Mar 2006 10:30:39 -0500
> 
> Action event of a PushButton:
> 
>   Dim sourceDictCnt as Integer
>   Dim targetDictCnt as Integer
>   Dim i, h as Integer
>  =20
>   If SourceDictionary.Count > 0 then
>     sourceDictCnt =3D SourceDictionary.Count - 1
>    =20
>     For i =3D 0 to sourceDictCnt
>       If not TargetDictionary.HasKey(SourceDictionary.Key(i)) then
>         ListBox1.AddRow SourceDictionary.Key(i)
>       End If
>     Next
>   End If
>  =20
>   If TargetDictionary.Count > 0 then
>     targetDictCnt =3D TargetDictionary.Count - 1
>    =20
>     For h =3D 0 to targetDictCnt
>       If not SourceDictionary.HasKey(TargetDictionary.Key(h)) then
>         ListBox2.AddRow TargetDictionary.Key(h)
>       End If
>     Next
>   End If
> 
> 
> Your main code (the code that parses the directories) could add the path =
> and
> file names as Value and Key pairs to the two dictionaries as it =
> populates
> the two lists.
> 
>   Dim i, sourceCount, targetCount as Integer
>   Dim sourceName, sourcePath as String
>   Dim targetName, targetPath as String
>   Dim sourceFolder, targetFolder as FolderItem
>   Dim sourceDict as New Dictionary
>   Dim targetDict as New Dictionary
>  =20
> // These are the source and target folders of the test I did.
> // They would be the two volumes that you are comparing using
> // your code.  This code is worthless to you for anything more
> // than a test and as an example of how to place your volume
> // data into two dictionaries for comparison later in the code
> // above.
> // sourceCount and targetCount are the number of files in the
> // test folders.  Since you will be using recursion, you would
> // have to get this count in a different way.  Every time an
> // element is added to a Dictionary, increment a counter.
>   sourceFolder =3D DesktopFolder.Child("Test").Child("Source")
>   sourceCount =3D sourceFolder.Count
>  =20
>   targetFolder =3D DesktopFolder.Child("Test").Child("Target")
>   targetCount =3D targetFolder.Count
> 
> // If there are files in the source and target folders, then
> // grab their names and absolute paths and add rows to your
> // two main ListBoxes as well as the temporary dictionaries
> // sourceDict and targetDict.
> // Dictionary Values =3D file name, Dictionary Keys =3D AbsolutePath.
> // If you find the results aren't working properly, you might
> // need to reverse this to:
> // Dictionary Values =3D AbsolutePath, Dictionary Keys =3D file name?
> // Remember, AbsolutePaths are generally discouraged.  Be very
> // careful when you use them.  Macs allow volumes to be mounted
> // that might have the same name.
>   If sourceCount > 0 then
>     For i =3D 1 to sourceCount
>       sourceName =3D sourceFolder.Item(i).Name
>       sourcePath =3D sourceFolder.Item(i).AbsolutePath
>       SourceList.AddRow sourceName
>       sourceDict.Value(sourceName) =3D sourcePath
>     Next
>   End If
>  =20
>   If targetCount > 0 then
>     For i =3D 1 to targetCount
>       targetName =3D targetFolder.Item(i).Name
>       targetPath =3D targetFolder.Item(i).AbsolutePath
>       TargetList.AddRow targetName
>       targetDict.Value(targetName) =3D targetPath
>     Next
>   End If
> 
> // Copy the temporary Dictionary information to the
> // Dictionary properties.  This allows you to use the
> // Dictionary information in other Methods.  You should
> // probably clear the dictionaries at this point so that =20
>   SourceDictionary =3D sourceDict
>   TargetDictionary =3D targetDict
> 
> _________________________________________________________
> 
> You should also note that this is a simple example.  I think what you =
> are
> trying to do is a lot more involved.
> 
>> If the first snippet is under the Action of a Pushbutton, where would =
> the
> main code go?
> 
> Anywhere you like.  For this test, it was in the Open event of the =
> window.
> You would probably want to call it from a PushButton, or call a separate
> method from a PushButton.


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to