Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2007
    Posts
    4

    Huh? Callback function In Zip.Add and Zip.Extract

    i need to know how to use the callback function with zipping and extracting files using a custom progress object and a custom cancel bottom so that they will appear in a specific position in the application and i just want the overall progress .. can anyone help me plzzzzz...

  2. #2
    Join Date
    May 2006
    Posts
    5,380
    Hi,

    heres a chunk of code i pulled from a old (unfinished) zip app i was working on a while ago, it uses progress bars and labels to show the current status

    you might be able to pick out what you need, or these functions are good to go as thay are (just change the names of the objects)

    Code:
    function ZipCallBack(File, Percent, Status)
    	if Status == ZIP_STATUS_MAJOR then
    		Progress.SetText("TotalProgress", Percent.."%");
    		Progress.SetCurrentPos("TotalProgress", Percent)
    	else
    		Progress.SetText("CurrentProgress", Percent.."%");
    		Progress.SetCurrentPos("CurrentProgress", Percent)	
    		Label.SetText("laFileProgress", File);
    	end
    	
    	if Abort then
    		return false
    	else
    		return true
    	end
    end
    
    function ResetProgress()
    	Progress.SetText("TotalProgress", 0);
    	Progress.SetCurrentPos("TotalProgress", 0)
    	Progress.SetText("CurrentProgress", 0);
    	Progress.SetCurrentPos("CurrentProgress", 0)	
    	Label.SetText("laFileProgress", "");
    	Button.SetVisible("btnCancel", false);
    end
    
    function OpenZip()
    	if Abort then
    		Abort = false
    	end
        GetFile = Dialog.FileBrowse(true, "Locate Zip File", _DesktopFolder, "All Files (*.*)|*.*|", "", "dat", false, false);
        if GetFile[1] == "CANCEL" then
        Application.ExitScript();
        else
        GetFolder = Dialog.FolderBrowse("Please select a folder to extract to:", _DesktopFolder);
            if GetFolder == "CANCEL" then
            Application.ExitScript();
            else
    		Button.SetVisible("btnCancel", true);
    		Zip.Extract(GetFile[1], {"*.*"}, GetFolder, true, true, "", ZIP_OVERWRITE_ALWAYS, ZipCallBack);
    		ResetProgress()
            err = Application.GetLastError();
                if (err ~= 0) then
                    Dialog.Message("Error", _tblErrorMessages[err], MB_OK, MB_ICONEXCLAMATION);
                end
            end
        end
    end 
    
    OpenZip();
    to cancel the zip, make a button and put in the on click,
    Code:
    Abort = true

    or if it makes it easier for you, heres the apz
    Last edited by RizlaUK; 02-01-2009 at 11:35 AM.
    Open your eyes to Narcissism, Don't let her destroy your life!!

  3. #3
    Join Date
    Jun 2007
    Posts
    4

    Thumbs up thxxxxxxxxxxx aloooooooooot

    really thanx maan thats exactly wt i was asking fooooooor

  4. #4
    Join Date
    Nov 2007
    Posts
    1

    Thank You So Much

    After many hours of trial and error
    After many hours of google
    After many hours of Searching this forum
    I finally found this post and it finally gave a good working custom progress meter
    So with that being said, RizlaUK I thank-you so very much
    yes i know its a old post but that matters not it helped me greatly
    and also if any one else has posted similar info i'm sorry, it just wasnt dummied down enough for me

  5. #5
    Join Date
    Aug 2006
    Posts
    13

    Thumbs up

    yeah this is what im looking for!!!! but maybe some edits??

    ComboBox.AddItem("ComboBox1", "Desktop", Shell.GetFolder(SHF_DESKTOP));

    whats the line for my autorun cd docs???

    and whats the code for extracting always to my documents??

    but this example rules!!!!!!!

  6. #6
    Join Date
    Aug 2006
    Posts
    13

    nobody???


    nobody can helps with this??

  7. #7
    Join Date
    Aug 2003
    Posts
    2,427
    My documents is Shell.GetFolder(SHF_MYDOCUMENTS)

    The docs folder of your project no matter where the application is running from is "AutoPlay\\Docs\\name_of_file.extension"

  8. #8
    Join Date
    Jun 2006
    Posts
    3

    @ RizlaUK

    when i hit the cancel button.
    the progress zip file extract still continue?
    why it doesnt stop the zip file extraction?

    br, raivenz

Similar Threads

  1. Show progress of zip install
    By Jonas DK in forum AutoPlay Media Studio 5.0
    Replies: 3
    Last Post: 07-25-2004, 05:57 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