PDA

View Full Version : Delimiters in List Box Objects



jmoisan
09-11-2002, 07:15 PM
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 ! /ubbthreads/images/icons/smile.gif

Adam
09-12-2002, 08:17 AM
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,,

Lorne
09-12-2002, 09:44 AM
You also prefer to end sentences with commas. /ubbthreads/images/icons/wink.gif

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? /ubbthreads/images/icons/smile.gif

jmoisan
09-12-2002, 02:44 PM
Thanks a lot ! You guys are the best ! /ubbthreads/images/icons/smile.gif

kpsmith
10-11-2002, 01:49 PM
Would this same sort of procedure apply for Tab delimited files or is there an easier way?

Lorne
10-11-2002, 02:12 PM
Yep, just use a constant like #ASC_TAB# and assign "9" to it.

kpsmith
10-11-2002, 02:14 PM
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....

Corey
10-11-2002, 02:21 PM
HA! Prefers to end his sentences with commas. Uproarious hilarity...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)