2 Replies Latest reply on Jun 5, 2006 5:37 AM by Terrence Martineau

    adding carriage returns to a text member or string variable

    Terrence Martineau Level 1
      I want to structure a text variable 1 line at a time and then put that text into text member and ultimately into an external text file but get a "wrong type" error when i use the below script. i'm assuming i can't refer to line in the text variabl until they are there, but how do i add them?

      also how do i go about taking the text in this text member into an external file.. or even better how do i take the text of the text variable into an external text file?
        • 1. Re: adding carriage returns to a text member or string variable
          Level 7
          There seems to be no "following code"


          The constant RETURN can be appendd to text to insert a new line


          myString = "Here's one line" & return & "a second line"


          member("textDisplay").text = myString -- would place it in a text member




          The fileIO xtra included with director is the standard for writing to a
          text file, the simplest form would take about 5 lines of code to get it
          to write to a text file.


          -- Here's a rough example


          myFile = new(xtra "fileio")
          openFile(myFile, myPath, 0) -- read/write access
          writeString(myFile,myString)
          closeFile(myFile)
          myFile = void -- purging xtra instance, also done by handler ending
          • 2. adding carriage returns to a text member or string variable
            Terrence Martineau Level 1
            thanks JB.. i think you've answered both my questions even without my code... got up this morning relized i hadn't included it and came to the forum to add it.. but looks like i already have my answers... thanks again!

            looks like you can only get text from stringVariable.line[x] and not set it in that way?

            what i had before is below...

            T.