VBScript Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

VBScript Examples

Bounced Mail
Bz2
Character Encoding
Digital Certificates
CSV
Digital Signatures
Email
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
PFX
RSA
S/MIME
SFTP
SMTP
Socket
Spider
SSH
SSH Key
SSH Tunnel
String
Tar
Upload
XML
XMP
Zip Compression
Self-Extractor

More Examples...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
Byte Array
RSS
Atom
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

 

XML Embed Binary File

Demonstrates how to embed a binary file in XML. Also extracts binary data from XML and saves to a file.

Download Chilkat FileAccess ActiveX (freeware)

Download Chilkat XML ActiveX

Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("output.txt", True)



'  Load a binary file from disk:
set fac = CreateObject("Chilkat.FileAccess")
fileData = fac.ReadEntireFile("dude.gif")

set xml = CreateObject("Chilkat.Xml")

xml.Tag = "gifData"

'  If set to 1, the binary data is automatically compressed
'  before being added to the XML.  In this example, GIF data
'  is already a compressed file format, so we another layer
'  of compression doesn't really help much...
zipFlag = 0

'  The data may be automatically 128-bit AES encrypted
'  if this flag is set to 1.
encryptFlag = 0

password = "NotUsed"

success = xml.SetBinaryContent(fileData,zipFlag,encryptFlag,password)

'  Examine the XML.  (The binary content is base64-encoded)
outFile.WriteLine(xml.GetXml())

'  Now extract the content to a file:
success = xml.SaveBinaryContent("out.gif",zipFlag,encryptFlag,password)
If (success <> 1) Then
    MsgBox xml.LastErrorText
End If

'  The original data may be saved using the FileAccess component in this way:
success = fac.WriteEntireFile("original.gif", fileData)
If (success = 0) Then
    MsgBox fac.LastErrorText
    WScript.Quit
End If


outFile.Close

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.

Mail Component · XML Parser