Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Realbasic > Re: replace tex...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 3260 of 3321
Post > Topic >>

Re: replace text in FolderItem names recursively

by that one more kid <ozgunbey@[EMAIL PROTECTED] > Sep 11, 2007 at 07:16 AM

Hi again,
I wrote that as a workaround, but it pops up OutOfBounds exception
when trying to write to array element 0

Sub RenameFolder(folder as FolderItem, oldtext as string, newtext as
string)
  // replace some string with another string in folder contents

  Dim i as Integer
  dim Changes as Integer
  dim Filenames() as String

  If folder.directory then
    if folder.count > 0 then
      Changes = 0
      For i=1 to folder.count
        if instr(0, folder.TrueItem(i).name, oldtext) > 0 then
          Filenames(Changes) = folder.TrueItem(i).name
          Changes = Changes + 1
        end if
      next
      for i = 0 to Changes
        Folder.TrueChild(Filenames(i)).Name =
replaceAll(Folder.TrueChild(Filenames(i)).Name, oldtext, newtext)
      next
    end if
    folder.name=replaceAll(folder.name, oldtext, newtext)
  else
    folder.name=replaceAll(folder.name, oldtext, newtext)
  end if
End Sub

any suggestions?
 




 3 Posts in Topic:
replace text in FolderItem names recursively
that one more kid <ozg  2007-09-11 00:59:33 
Re: replace text in FolderItem names recursively
that one more kid <ozg  2007-09-11 07:16:56 
Re: replace text in FolderItem names recursively
Joe Strout <joe@[EMAIL  2007-09-11 09:03:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Jul 8 23:09:25 CDT 2008.