Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Posts
    9

    ZipExtract "callback" error

    Hi,

    I get this weird error when trying to unzip a file to my harddrive.

    I just copied the example from the help file and changed the zip filename and password. I reckon i had this working a few months ago when testing the feature, but now i get an error:

    OnClick, Line 38: attempt to index global `tblErrorMessages' (a nil value)

    what do i have to put instead of a nil value? i don't want to define a special callback function..

    here's my code
    Code:
    -- Allow the user to select a directory to unzip the files.
    target_folder = Dialog.FolderBrowse("Select a Folder", "C:\\");
    
    
    -- Check to see if the user cancelled or an error occurred.
    if (target_folder ~= "CANCEL") and (target_folder ~= "") then
        -- Gets a list of the contents of a zip file.
        zip_contents = Zip.GetContents("AutoPlay\\Docs\\2.zip", true);
    
        -- Get the error code of the last action.
        error = Application.GetLastError();
    
        -- If an error occurred, display the error code message.
        if (error ~= 0) then
            Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
        else
            -- Take the table and turn it into a string with newlines for displaying.
            zip_contents_display = Table.Concat(zip_contents, "\r\n", 1, TABLE_ALL);
    
            -- Ask the user if they are sure they would like to unzip the contents.
            result = Dialog.Message("Information", "The following files will be unzipped:\r\nClick the Cancel button to abort the process.\r\n\r\n"..zip_contents_display, MB_OKCANCEL)
    
            -- If the user clicked Ok, unzip the files.
            if (result == IDOK) then
                -- Show the status dialog.
                StatusDlg.Show();
                -- Extract the contents of the Zip file.
                Zip.Extract("AutoPlay\\Docs\\2.zip", {"*.*"}, target_folder, true, true, "mYpAssWorD", ZIP_OVERWRITE_NEVER, nil);
    
                -- Check the error code for the last action.
                error = Application.GetLastError();
    
                -- Hide the status dialog.
                StatusDlg.Hide();
    
                -- If an error occurred, display the error code message.
                if (error ~= 0) then
                    Dialog.Message("Errror", tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
                else
                    Dialog.Message("Success", "The unzipping was successful.", MB_OK, MB_ICONINFORMATION);
                end
            end
        end
    end

  2. #2
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    You do not have the underscore in _tblErrorMessages[error]
    Intrigued

  3. #3
    Join Date
    Nov 2004
    Posts
    9
    Holy smoke, that was it....

    btw. I just copied the code from the help file, so the underscore is missing from there as well.

    Cheers!

Similar Threads

  1. Function: Blowfish Encrypt/Decrypt Strings
    By Lorne in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 05-31-2004, 03:16 PM
  2. Error Message: "IrSetup.exe generated error"
    By EdwinFu in forum Setup Factory 6.0
    Replies: 1
    Last Post: 10-10-2003, 10:09 AM
  3. Cannot create directory error.
    By jassing in forum Setup Factory 6.0
    Replies: 3
    Last Post: 03-10-2003, 01:37 PM
  4. SUF6.0.0.2 -- installer hangs.
    By jassing in forum Setup Factory 6.0
    Replies: 4
    Last Post: 12-19-2001, 11:28 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