ArcPad Scripting Object Model
PutFile Method
See Also  Example  Send comments on this topic.
LocalFile
Required. A String that represents the full path of the file on the local device.
ZipFile
Required. A String that represents the name of the file inside the archive.
Archive Object : PutFile Method

Glossary Item Box

Description

Adds the specified local file to the archive.

Syntax

object.PutFile ( LocalFile, ZipFile )

Parameters

LocalFile
Required. A String that represents the full path of the file on the local device.
ZipFile
Required. A String that represents the name of the file inside the archive.

Return Type

Boolean

Example

PutFile Example
Adds a file to a ZIP Archive.
PutFile Example (VBScript)Copy Code
Sub PutFile(strArchiveFile, strPassword, strSourceFile, strCompressedFile)
      ' 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
      
      ' Insert a file into the ZIP archive.      
      Dim blnResult
      blnResult = pArchive.PutFile(strSourceFile, strCompressedFile)
      
      ' Close the ZIP archive
      pArchive.Close()

      ' Display the results
      If (Not blnResult) Then
            Application.MessageBox "Failed to add file.", vbCritical, "Error"
      Else
            Application.MessageBox   strSourceFile & " added as " & strCompressedFile, vbInformation, "Success"
      End If
End Sub

See Also

© 2012 All Rights Reserved.