I’m trying to edit an existing text file by a VB script that do search the text file for a certain content (e.g. searching the text file for letter “B” which is connected to the input “Y” of the VB component) and then to add certain multiline text below it (e.g. the content of the connected panel to the input “Z” of the VB component) to be in one branch only (as in the blue panel) instead of creating multiple branches for each added line,Edit text file.gh (12.2 KB)
as shown in the attached photo
Please in Grasshopper go to “Display” tab and turn on “Draw Fancy Wires”. (just because it is useful)
Your VB component is reading “z” input as single item, but because “z” is a list of 4 items it is running 4 times in total, every time with the next item in “z”.
See the pic in my reply here: Get brep for checking intersect and performing boolean union and set “z” as “list access”.
Then, with “lines(i + 1) = (z)” you are replacing the item at “i+1” index (“C” in your case) with another item… instead, you probably want to insert ( https://msdn.microsoft.com/en-us/library/bb383995.aspx ) your items.
(maybe …Instead of “lines(i + 1) = (z)” , do a small for cycle to insert every item in “z” list in “lines” list. )