Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 11 of 11
  1. #1
    Join Date
    Aug 2006
    Posts
    355

    to keep several items from listbox to txt

    hello,

    pardon by my ingles

    I have listbox, with I number indefinit of items, each beginning can be I number different (perhaps 8 items and following the 20 items... etc)

    And gustaria me to include a button that has scrip to keep the list from items (the text) in txt.

    Example:

    My listbox

    a
    b
    c
    d
    etc...

    and that to keep it in txt.

    some suggestion?

    thank you very much to all

  2. #2
    Join Date
    Aug 2006
    Posts
    355
    please help!

  3. #3
    Join Date
    Nov 2005
    Posts
    98
    Try this, but it is very basic

    TextToWrite = ""
    nbOfLines = ListBox.GetCount("ListBox1");
    -- A repeat ... until loop
    numLoopCount = 1;
    repeat
    -- Do something here
    Text = ListBox.GetItemText("ListBox1", numLoopCount);
    if TextToWrite ~= "" then
    TextToWrite = TextToWrite .. "\r\n" .. Text
    else
    TextToWrite = Text
    end
    numLoopCount = numLoopCount + 1;
    until numLoopCount == nbOfLines + 1;
    TextFile.WriteFromString("C:\\MyFile.txt", TextToWrite, false);

    Good luck,
    Eliminator

  4. #4
    Join Date
    Oct 2004
    Location
    East, South & West Asia
    Posts
    1,020
    Hi SOlmos,

    Ejemplos adentro aquí .

    Búsqueda para:

    >>> AMS 6 [ TEXT FILE ] Examples.
    * LIST BOX to TEXT FILE
    - Import ListBox Data to Text File
    - View Text File
    Newbie Examples
    ------> AMS 7.5 : amstudio.azman.info
    ----> AMS 6 & 5: www.azman.info/ams/
    ----> FB: facebook.com/GuideToWealth

    ----> Content Development Blog: www.AZMAN.asia

  5. #5
    Join Date
    Aug 2006
    Posts
    355
    thank you very much Eliminator it works very well

    thanks azmanar for the examples, very utiles, you are the best ones!

    another question

    I like now to know to do operation inverse, that is to say, to look for file txt in system and what contains that is in the ListBox, of this form:

    content of txt:
    a
    b
    c
    etc...

    Content shown in listbox:

    a
    b
    c
    etc..

    and by I complete, to compare the two text of listbox, considering that can be the same one in I do not number of items, asi then, if an item not this present, that is a message.

    pardon therefore to bother, I thank for much thank you very much to you the aid!

  6. #6
    Join Date
    Aug 2006
    Posts
    355
    Quote Originally Posted by Solmos View Post
    thank you very much Eliminator it works very well

    thanks azmanar for the examples, very utiles, you are the best ones!

    another question

    I like now to know to do operation inverse, that is to say, to look for file txt in system and what contains that is in the ListBox, of this form:

    content of txt:
    a
    b
    c
    etc...

    Content shown in listbox:

    a
    b
    c
    etc..

    and by I complete, to compare the two text of listbox, considering that can be the same one in I do not number of items, asi then, if an item not this present, that is a message.

    pardon therefore to bother, I thank for much thank you very much to you the aid!
    Help please!

  7. #7
    Join Date
    Aug 2006
    Posts
    355
    some suggestion please?

  8. #8
    Join Date
    Oct 2004
    Location
    East, South & West Asia
    Posts
    1,020
    Hi Solmos,

    I assume you want to check whether an item in LISTBOX has the same item in the TEXT FILE.

    It depends on how you Grab the txt file. It can be into a STRING VARIABLE or TABLE.

    Say you grab the text file contents into a STRING VARIABLE. You use TextFile.ReadToString . Say, you name this variable as sText.

    Then you need to read each item in the ListBox using the loop FOR..DO. Everytime you read the item in the ListBox, you make into a STRING VARIABLE. Say, you name this item as sLB_Text. In the FOR..DO, use sLB_Text= ListBox.GetItemText("ListBox1", sLBitem );

    Within the same step ( in the loop ), you check sLB_Text in the string sText by using nFound = String.Find(sText, sLB_Text, 1, false).

    then use the IF...THEN.

    if nFound~=-1 then
    Dialog.Message("FOUND!", "There is an item found in the text file", MB_RETRYCANCEL);
    else
    Dialog.Message("NOT FOUND!", "No item in the text file", MB_RETRYCANCEL);
    end

    Actually it is very flexible on how you want to it to happen, even to the collect the items found in the listbox into another listbox or do many other things in the FOR...DO loop.

    Try do it. If after many tries you cannot do it, message me.
    Newbie Examples
    ------> AMS 7.5 : amstudio.azman.info
    ----> AMS 6 & 5: www.azman.info/ams/
    ----> FB: facebook.com/GuideToWealth

    ----> Content Development Blog: www.AZMAN.asia

  9. #9
    Join Date
    Aug 2006
    Posts
    355
    azmanar please, one example complete of the scrip, please!!

    the text document has east format:

    text:
    aaaa
    bbbb
    cccc

    and in listbox for example:

    aaaa
    kkkk
    bbbb

    desire to verify if the data of the text document estan present in listbox and that it says to me if each one of them exists or no. muchasa thanks!

    thx!!
    Last edited by Solmos; 01-09-2007 at 01:32 AM.

  10. #10
    Join Date
    Aug 2006
    Posts
    355
    azmanar please, one example complete of the scrip, please!!

    the text document has east format:

    text:
    aaaa
    bbbb
    cccc

    and in listbox for example:

    aaaa
    kkkk
    bbbb
    desire to verify if the data of the text document estan present in listbox and that it says to me if each one of them exists or no. muchasa thanks!

    this is my scrip:

    aa = Dialog.FileBrowse(true, "select document", _DesktopFolder, "document .txt (*.txt)|*.txt|", "", "txt", false, false);
    error = Application.GetLastError();

    if error ~= 0 then
    Dialog.Message("Error",_tblErrorMessages[error]);
    else
    if (aa == nil) then
    Dialog.TimedMessage("Error", "NONE", 3000, MB_ICONINFORMATION);
    else

    for index, sLBitem in aa do
    sText = TextFile.ReadToTable(path);
    sLB_Text = ListBox.GetItemText("ListBox2", sLBitem);
    nFound = String.Find(sText, sLB_Text, 1, false)
    if nFound~=-1 then
    Dialog.Message("FOUND!", "There is an item found in the text file", MB_RETRYCANCEL);
    else
    Dialog.Message("NOT FOUND!", "No item in the text file", MB_RETRYCANCEL);
    end

    end
    end
    end
    I need that it says when verifying the text to me in txt all the archives that exist and all those that do not exist

  11. #11
    Join Date
    Aug 2006
    Posts
    355
    please help!

Similar Threads

  1. Multiple selection delete items from a listbox
    By Tek in forum AutoPlay Media Studio 6.0
    Replies: 2
    Last Post: 05-03-2006, 09:18 AM
  2. Selecting multiple items in a listbox
    By AlphaVortex in forum AutoPlay Media Studio 5.0
    Replies: 4
    Last Post: 03-30-2005, 01:34 PM
  3. adding items to the listbox
    By Stephen G. in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 05-11-2004, 07:27 AM
  4. Example: Using the ListBox object
    By Ted Sullivan in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 05-07-2004, 12:24 PM
  5. is there a way to format listbox items?
    By intel352 in forum Setup Factory 6.0
    Replies: 3
    Last Post: 02-07-2003, 04:03 PM

Posting Permissions

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