Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2002
    Location
    Sao Paulo - Brazil
    Posts
    10

    List Box Object (loading at runtime)

    Sugestion:

    A function that Imports a TXT file at run time in a list box object.

    Thanks,

    Rene Baccarelli de Almeida
    Practica Global Media
    Sao Paulo - Brasil

  2. #2
    Join Date
    May 2000
    Location
    Indigo Rose Software
    Posts
    2,150

    Re: List Box Object

    From another post:


    What you could do in this case is read the text file using a TEXT FILE->READ action which would read the text file into a variable. Just make sure that it is formatted correctly with the proper delimiters.

    Then you could use a LISTBOX OBJECT->ADD action and place the variable in the "Items to add" field. This should accomplish what you are looking to do.
    Hope that helps.

    Sincerely,
    Darryl Hnatiuk
    Indigo Rose Corporation
    Thanks

  3. #3
    Join Date
    Jun 2002
    Location
    Sao Paulo - Brazil
    Posts
    10

    Re: List Box Object

    Ok, it work´s, but in my txt file I have one item per line and the delimiter is a carriage return ( enter ).

  4. #4
    Join Date
    Dec 1969
    Posts
    123

    Re: List Box Object

    Is that meaning it doesnt work properly?

    Format for txt file (if yurs doesnt work) is more likely to be:

    Item1;;Item2;;Item3 etc etc

  5. #5
    Join Date
    Jun 2002
    Location
    Sao Paulo - Brazil
    Posts
    10

    Re: List Box Object

    I can´t change the TXT file. This file is generated by another program.

    Thanks

  6. #6
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728

    Re: List Box Object

    Load the file into a variable, then do a search and replace on the text in that variable to replace every carriage return/line feed combination with ;; (or whatever delimiter you intend to use).

    You'll need to set up a pair of design-time constants to represent the carriage return and line feed. Something like this:

    #ASC_CR# <-- assign "13" to this one
    #ASC_LF# <-- assign "10" to this one

    (I may have those ASCII values reversed -- I can never remember which one is which -- but you get the idea.)

    Then replace every "#ASC_CR##ASC_LF#" with ";;" in the string.

    That will convert every newline to a ;;.
    --[[ Indigo Rose Software Developer ]]

  7. #7
    Join Date
    Jun 2000
    Location
    Indigo Rose Software
    Posts
    1,943

    Re: List Box Object

    Hi,

    If you wanted, you could parse the Text file line by line using our Text File actions.

    mark.
    MSI Factory The Next Generation Intelligent Setup Builder

  8. #8
    Join Date
    May 2000
    Location
    Indigo Rose Software
    Posts
    2,150

    Re: List Box Object

    There may be a way to get all of the information to show properly in a ListBox Object.

    Try making a script that does something like:

    %Count% = "0"
    %LineCount% = TextFile.CountLines("c:\....")
    WHILE (%Count% < %LineCount%)
    . %TextLine% = TextFile.GetLine ("C:\.....",%Count%)
    . ListBoxObject[ListBox1].Add (End,"%TextLine%")
    . %Count% = Evaluate (%Count% + 1)
    END WHILE

    I have not actually tested this script but I think that it will work.



  9. #9
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728

    Re: List Box Object

    Heh, my way only needs 2 actions, and it's faster:

    %TextFile% = TextFile.Read("filename")
    %NewString% = String.Replace("%TextFile%", "#ASC_CR##ASC_LF#", ";;")

    Or just copy and paste this (make sure you change the name of the text file).



    31
    0
    0
    1

    2

    0


    %TextFile%
    C:\Music\A-Ha - Lifelines.m3u


    60
    0
    0
    1

    2

    0


    %NewString%
    %TextFile%
    #ASC_CR##ASC_LF#
    ;;
    1




    Make sure you add the two design-time constants on the Configurations tab of the Project Settings dialog, too:

    Name: #ASC_CR#
    Value: 13

    Name: #ASC_LF#
    Value: 10
    --[[ Indigo Rose Software Developer ]]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts