ArcPad Scripting Object Model
GetFiles Example
Send Feedback
ArcPad Scripting Object Model Reference > ArcPad Scripting Samples > GetFiles Example

Glossary Item Box



Extracts a file from a ZIP Archive and stores it to disk.
If the file in the ZIP Archive has been password protected, the correct password must be supplied. Otherwise, ArcPad will generate a Permission Denied script error.

VBScript Code

Copy Code
Sub GetFile(strArchiveFile, strPassword, strCompressedFile, strExtractedFile)
      ' Open the ZIP archive
      Dim pArchive
      Set pArchive = Application.CreateAppObject("Archive")
      If (Not pArchive.Open(strArchiveFile)) Then Exit Sub
      pArchive.Password = strPassword
      ' NOTE: Alternatively, password can be supplied as an argument to the Open method
      ' Extract a file from the ZIP archive.
      Dim blnResult
      blnResult =   pArchive.GetFile(strCompressedFile, strExtractedFile)      
      ' Close the ZIP archive
      ' Display the results
      If (Not blnResult) Then
            Application.MessageBox "Failed to extract file.", vbCritical, "Error"
            Application.MessageBox strCompressedFile & " extracted to " & strExtractedFile, vbInformation, "Success"
      End If
End Sub
©2012. All Rights Reserved.