Delimiters in List Box Objects

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • jmoisan
    Forum Member
    • Jun 2002
    • 15

    Delimiters in List Box Objects

    Here's my problem : I want to make a playlist editor for my video player. When I load the playlist editor, it reads my TXT file (which has all the file paths to my video files, one on each line), and puts it into a variable called %Playlist%. After that, I use the "List Box Objects > Add" action to put the %playlist% variable's value into my List Box Object, but once again, the paths are delimited by a <Enter> (one path on each line in my TXT file). How can I tell AMS4 to use a <Enter> as a delimiter ? 'Cause now in run time, the List Box has only one object, which is all the paths in my TXT file, separated with weird square symbols ???

    Thanks in advance ! [img]/ubbthreads/images/icons/smile.gif[/img]
  • Adam
    Indigo Rose Staff Member
    • May 2000
    • 2149

    #2
    Re: Delimiters in List Box Objects

    Have you thought about just editing the text file by hand, remove all the 'end of line' characters and replace with a good delimiter (; or something like that.

    Else I'm sure that Lorne has a fancy way to use the end of line character as a delimiter.

    Personally I prefer the simple solutions,,

    Comment

    • Lorne
      Indigo Rose Staff Member
      • Feb 2001
      • 2729

      #3
      Re: Delimiters in List Box Objects

      You also prefer to end sentences with commas. [img]/ubbthreads/images/icons/wink.gif[/img]

      There are two really easy ways to do it. Both of them involve creating a pair of design-time constants to represent the carriage return (CR) and linefeed (LF) characters.

      (In Windows, each line in a text file is terminated by a CR and LF pair, usually referred to as "CRLF".)

      To set up those constants, go to the Project Settings dialog, click on the Configurations tab, select a build configuration (e.g. Default Build), and then add these two constants:

      Name one of them #ASC_CR#, with a value of 13.

      Name the other one #ASC_LF#, with a value of 10.

      #ASC_CR# and #ASC_LF# will be replaced at build time with the characters represented by numbers 13 and 10 (hex 0D and 0A) in the ASCII table.

      Now, armed with a way to "type" a CR and LF in AutoPlay, we can use one of two methods to get that text file's contents into the list box.
      • Just use #ASC_CR##ASC_LF# as the delimiter in your "List Box Object - Add" action.
      • Or, use a "String - Replace" action to replace every occurence of #ASC_CR##ASC_LF# in the text with whatever delimiter you want to use in the "List Box Object - Add" action.


      Easy, huh? [img]/ubbthreads/images/icons/smile.gif[/img]
      --[[ Indigo Rose Software Developer ]]

      Comment

      • jmoisan
        Forum Member
        • Jun 2002
        • 15

        #4
        Re: Delimiters in List Box Objects

        Thanks a lot ! You guys are the best ! [img]/ubbthreads/images/icons/smile.gif[/img]

        Comment

        • kpsmith
          Forum Member
          • Jul 2000
          • 332

          #5
          Re: Delimiters in List Box Objects

          Would this same sort of procedure apply for Tab delimited files or is there an easier way?

          Comment

          • Lorne
            Indigo Rose Staff Member
            • Feb 2001
            • 2729

            #6
            Re: Delimiters in List Box Objects

            Yep, just use a constant like #ASC_TAB# and assign "9" to it.
            --[[ Indigo Rose Software Developer ]]

            Comment

            • kpsmith
              Forum Member
              • Jul 2000
              • 332

              #7
              Re: Delimiters in List Box Objects

              Uh, never mind I figured it out. Thanks Lorne for the tip...

              For those that want the info you would simply do the following to represent the Tab Character...

              SET

              #ASC_TAB#, with a value of 09

              And then just use #ASC_TAB# for your delimiter

              Looks like Lorne beat me to it....

              Comment

              • Corey
                Indigo Rose Staff Alumni
                • Aug 2002
                • 9745

                #8
                Re: Delimiters in List Box Objects

                HA! Prefers to end his sentences with commas. Uproarious hilarity...

                Corey Milner
                Creative Director, Indigo Rose Software

                Comment

                Working...
                X