Unzipping zip files?

  1. ‹ Older
  2. 5 years ago

    Garth H

    27 Oct 2014 Pre-Release Testers, Xojo Pro

    @Dave Sisemore Nobody has yet to say why this is not a viable solution...... because it does seem to work
    and it works with OSX and Win7 No shell, no plugins, cross platform.... simple.

    I'll knock it down.

    It makes an assumption that the computer has some kind of program that unzips files AND (most importantly) it is set up in such a way that launching a .zip file will launch that program and it'll do the extracting. BIG ASSUMPTION.

    In my experience I assumed that within my updating scheme and boy did I ask for it. Lot's of Mac users had something setup OTHER than the default (more about that below) and the Mac just didn't know what to do. Mostly this was people who still thought StuffIt was relevant and had it installed, by their choice or not.

    A big problem with Mac's default unzipping ('Archive Utility') is that it's not an application - it's a sort of internal service that the OS provides but yet it looks like an app. Unzip a large .zip file and you'll see what I mean - do ALT-TAB and you'll see the ugly green "zipper" icon. That further complicates, confuses, and mixes up what a Mac does for unzipping.

    I'm real good at running my computer, but I still have to have unzipping programs on my program, mainly to deal with RAR files. BetterZip and UnRar are on my machines, and sometimes it's difficult to stop the Mac from using those programs to unzip zip files -the OS is frisky one day and wants to associate them, when I don't want them to. Plus, since Archive Utility is NOT an app, it makes it that much more complicated.

    And you want me to explain that to a customer? =) NOT

  3. Merv P

    27 Oct 2014 Pre-Release Testers, Xojo Pro

    I use the MBS compression plugin as suggested earlier. One thing that it does rather well, that I ran into problems with other solutions, is unzipping zip files that are encrypted with a password.

  4. Sam R

    28 Oct 2014 Pre-Release Testers, Xojo Pro, Third Party Store Hengchun, Pingtung, Taiwan

    on OS X there's an API for unzipping files (I can look it up), but it can also be done with the ditto console function.

  5. Michel B

    28 Oct 2014 Pre-Release Testers, Xojo Pro

    @Sam R on OS X there's an API for unzipping files (I can look it up), but it can also be done with the ditto console function.

    I know it is frowned upon, but shell works wonderfully. I even have a line command GUI interface app for encrypted archives based on that in the MAS.

  6. Sam R

    28 Oct 2014 Pre-Release Testers, Xojo Pro, Third Party Store Hengchun, Pingtung, Taiwan

    @Michel B I know it is frowned upon, but shell works wonderfully. I even have a line command GUI interface app for encrypted archives based on that in the MAS.

    Console/Terminal/Shell functions are not normally frowned upon... Unless there is an API to use, in theory APIs are the more efficient/reliable way to do things... Unless you're targeting OS X, where Apple changes APIs more often than some people change their underwear (for those that actually wear underwear).

  7. John F

    29 Oct 2014 Pre-Release Testers, Xojo Pro Omaha, Nebraska

    If you're looking for a professional solution, then I can't say enough about MBS's plugin for creating and extracting zip files on both Windows and Mac. We converted an application in use by thousands of users that was formerly Windows only and used a active-x control called Dynazip. We thought we'd never be able to duplicate the functionality of our previous application. You'd be surprised (maybe not) how fussy users can be when they've been using an application for 10, 15, 20 years or more.

    We looked for every possible solution and MBS's plugin was the only option that we could find that allowed us to duplicate the functionality of our former application's zipping features and unbelievably does it even faster.

    If you're looking for something for home grown use, you can probably get by with much less, but if you're looking for something to distribute, save yourself a lot of time and effort and get the plugin. Be happy to share some code if you want to save even more time.

  8. 3 years ago

    John H

    18 Aug 2017 Pre-Release Testers Planet earth
    Edited 3 years ago

    You can unzip files in windows as I mentioned in this link: https://forum.xojo.com/18130-native-unzip-on-windows

    Here is the code that will works for windows:

      Dim ZipFile, ExtractTo As String
      Dim fso, objShell, FilesInZip, MyFolder1, MyFolder2 As OLEObject
      Dim ZipParams(1), ExtractParams(1) As variant
        
      ZipFile = "C:\Temp\test.zip"
      ExtractTo = "C:\Temp\Test"
      
      ZipParams(1) = ZipFile
      ExtractParams(1) = ExtractTo
      
      //If the extraction location does not exist create it
      fso = New OLEObject("Scripting.FileSystemObject")
      If NOT fso.FolderExists(ExtractTo) Then
        fso.CreateFolder(ExtractTo)
      End If
        
      objShell = New OLEObject("Shell.Application")
      MyFolder1 = objShell.Invoke("NameSpace", ZipParams)
      MyFolder2 = objShell.Invoke("NameSpace", ExtractParams)
        
      //More info see: http://msdn.microsoft.com/en-us/library/windows/desktop/bb787868%28v=vs.85%29.aspx
      //Extract the contents of the zip file.
      //    4 = Do not display a progress dialog box.
      //   16 = Respond with "Yes to All" for any dialog box that is displayed.
      //  512 = Do not confirm the creation of a new directory if the operation requires one to be created.
      // 1024 = Do not display a user interface if an error occurs.
     
      MyFolder2.CopyHere(MyFolder1.Items, 4+16+512+1024) 
        
      fso = Nil
      objShell = Nil
      
    exception err as oleexception
      msgbox err.message
  9. Kem T

    18 Aug 2017 Pre-Release Testers, Xojo Pro, XDC Speakers, MVP Connecticut

    As anyone who uses Kaju on Windows can tell you, John's code works beautifully.

or Sign Up to reply!