Jeff asked: >Anyone know why the program below Staz sent me doesn't work? > >With FutureBASIC 1.02 it crashes or I get the message I get with FBII >With FutureBASIC II (3.2.1) says line DIM @volRefNum% "Invalid String/Record >length specified." >With FB^3 Editor(3.2.0) no changes are made. The converted file is the same >as the original. Still 90382 bytes, and it looks identical. Jeff, I have rewritten and heavily commented your program for use in FB^3. (This was tested in FB^3 Release 5, but should work in all earlier versions.) To make it simpler to understand, I suggest you create a text file with the following sentence: This is a teeest documeeent with theee leeetteeer "eee" purposeeely meeesseeed up. As you can see, each "e" in the sentence has been tripled. We will use your program to fix that. Once you have created your text file, run the following from FB^3 using the Standard runtime, then examine the revised file. The tripled "e' problem should be corrected. If this works for you, you can begin to adjust the find and replace strings to suit your needs. Note that you can use the fancy Navigation Services dialog by uncommenting the appropriate line. (I find NavServices to be slow, but it is the wave of the future so I guess we should begin riding it!) I have written this hurriedly, but I hope it suffices as a springboard to assist you to reach your goal. As always, suggestions, criticisms, bug fixes, better implementations are invited from the list. Ken Caution: Watch for e-mail line breaks and lost constant underscores '----- BEGIN FB^3 CODE ------- DIM AS INT @volRefNum% DIM AS HANDLE @textH DIM AS LONG offset, size DIM AS STR31 oldFileNameStr, newFileNameStr DIM AS STR15 findStr, replaceStr // Start with a nice, clean, empty text handle textH = 0 // If you want fancy NavServices, uncomment the next line // gFBUseNavServices = _zTrue // Open a text file and get its name oldFileNameStr = FILES$( _fOpen, "TEXT", , volRefNum% ) // Read text from the open file into a handle LONG IF oldFileNameStr[0] OPEN "I", 1, oldFileNameStr, , volRefNum% // Determine the size of the data in the file size = LOF( 1, 1 ) LONG IF size // Size our text handle to hold the data textH = FN NewHandle( size ) LONG IF textH // Read text data into our handle READ FILE #1, [textH], size END IF END IF // Close the original file-- we're done with it CLOSE #1 END IF // Set the characters to find and replace findStr = "eee" replaceStr = "e" // Get the text handle and mung it from the beginning... LONG IF textH //... this is the beginning offset = 0 DO offset = FN Munger( textH, offset, @findStr[1],¬ findStr[0], @replaceStr[1], replaceStr[0] ) UNTIL offset = -1 END IF // Measure the size our of our new munged text handle size = FN GETHANDLESIZE( textH ) // Adjust the name of our new file newFileNameStr = oldFileNameStr + " (rev.)" // Open a nice new file with our new name DEF OPEN "TEXT" OPEN "O", 1, newFileNameStr, , volRefNum% // Put our munged text into the file WRITE FILE #1, [textH], size // Be kind of mother and empty the trash CALL DisposeHandle( textH ) // Close the new file CLOSE #1 ' -------- END CODE -----------