Indigo Rose Software

Professional Software Development Tools

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

    Star to eliminate archives from the PC, the multiple selection in listbox

    like eliminating archives in the PC from or several items selected in listbox?

    for example,

    the items of my listbox:

    C:\ss.txt
    C:\jj.txt
    D:\vv.txt

    the 3 items selected in listbox, like making simultaneously to eliminate them of the PC the 3?

    and like doing that, for example, if item 1 fails the eliminated being, one does not erase of the list of items of listbox, but if it is eliminated correctly of the PC, that is also eliminated of the list of listbox

    thank you very much!

  2. #2
    Join Date
    Feb 2005
    Location
    Mn
    Posts
    770
    Have a look at Samples by Azmanar he has some listboxs that might help you.
    http://www.azman.info/ams/

  3. #3
    Join Date
    Aug 2006
    Posts
    355
    thanks but in no of those example put what I look for aid please!

  4. #4
    Join Date
    May 2006
    Posts
    5,380
    ok, there is a great example of almost what you need in the ams manual, im sure with a little bit of editing you will achive your goal

    -- Gets the path to the user's My Documents folder.
    my_docs_path = Shell.GetFolder(SHF_MYDOCUMENTS);

    -- Check to see if the My Documents folder detection was successful.
    if (Application.GetLastError() == 0)then

    -- Search the user's My Documents folder for the file "Data.ini".
    search_results = File.Find(my_docs_path, "Data.ini", true, false, nil);

    --Check to see if an error occurred during the search. If it did, display the error message.
    error = Application.GetLastError();
    if error ~= 0 then
    Dialog.Message("Error",_tblErrorMessages[error]);
    else

    -- If no files were found, notify the user.
    if (search_results == nil) then
    Dialog.Message("Notice", "Data.ini was not found in your My Documents folder.");

    -- If files were found, display a dialog containing a list of their locations.
    -- Also ask for deletion confirmation.
    else
    message = "Data.ini was found in the following location(s). Click OK to delete the file(s):\r\n\r\n";
    for index, path in search_results do
    message = String.Concat(message, path.."\r\n");
    end
    proceed = Dialog.Message("File Search Results", message, MB_OKCANCEL, MB_ICONQUESTION, MB_DEFBUTTON1);

    -- If the user clicked OK, delete all of the files found.
    if proceed == IDOK then

    -- Delete each file found in the search.
    for index, path in search_results do
    File.Delete(path, false, false, false, nil);

    -- Check to see if any errors occurred during the deletion.
    if (Application.GetLastError() ~= 0) then
    Dialog.Message("Error", "The file located at: "..path.." could not be deleted.");
    end
    end
    end
    end
    end
    end

    This example uses the File.Find action to search for all copies of a particular INI file in the user's My Documents folder. If the file is found in more than one location, the user is presented with the list and asked if they wish to delete them. If they agree, each copy is deleted using the File.Delete action.
    Open your eyes to Narcissism, Don't let her destroy your life!!

  5. #5
    Join Date
    Aug 2006
    Posts
    355
    thanks,

    it works well

    but I need that I eliminate the present archives in listbox, and if she eliminates it correctly that also she eliminates the text of listbox.

    for example, this listbox is the content of my:

    C:\Documents and seting\xx.txt
    D:\mydocument.txt
    D:\Temp\temp.txt

    if the user selects the three items (in listbox, with the activated multiselection), that the selected items are eliminated of the PC, and if they are eliminated correctly, tam, is eliminated well of listbox.

    thanks!

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

  7. #7
    Join Date
    May 2006
    Posts
    5,380
    then you just need to add a "ListBox.DeleteItem" in with your "File.Delete"

    attach the apz for what you have now and i'll see if i can come up with something, but not knowing how you have coded your app i cant realy help,

    you could try something like this

    this will delete the selected item a listbox and the file wich path is in the selected items data
    sel = ListBox.GetSelected("ListBox1");
    if sel then
    LBData = ListBox.GetItemData("ListBox1", sel[1]);
    File.Delete(LBData, false, false, false, nil);
    ListBox.DeleteItem("ListBox1", sel[1]);
    end
    but its very short and crude and no error checking
    Open your eyes to Narcissism, Don't let her destroy your life!!

  8. #8
    Join Date
    Aug 2006
    Posts
    355
    thank you very much,

    problem I am using your scrip, I have modified it a little, and added some things and now it works perfectly.

    thanks!

  9. #9
    Join Date
    May 2006
    Posts
    5,380
    Hey no problem, glad you got it in the end
    Open your eyes to Narcissism, Don't let her destroy your life!!

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. Populating a 2nd listbox based on the 1st listbox selection!
    By RileyBob in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 04-30-2005, 10:43 PM
  3. 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
  4. ListBox - Multiple File Format Question
    By Rubix101 in forum AutoPlay Media Studio 4.0
    Replies: 3
    Last Post: 02-16-2003, 09:49 PM
  5. Multiple file selection
    By Erwin Buts in forum Setup Factory 5.0
    Replies: 4
    Last Post: 12-08-2000, 02:36 AM

Posting Permissions

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