Events
There are no upcoming events
Older Stories
Friday 23-Sep
Monday 05-Sep
Saturday 20-Aug
Wednesday 13-Jul
Saturday 25-Jun
Wednesday 22-Jun
Sunday 08-May
Thursday 10-Feb
Wednesday 17-Nov
|
|
Welcome to Woods Applied Technologies Saturday, September 04 2010 @ 02:45 AM MDT
Nice VB Library
Monday, November 28 2005 @ 11:33 AM MST
Contributed by: cary
Views: 3,202
 It's not new ...but we just found it. A very handy VB library.
This is a comprehensive component, packed with 66 of useful methods, that is able to operated from ASP, Visual Basic, VBA, WSH(Windows Scripting Host).
Release Notes Sep 11, 2001
BASP21 belongs to Tatsuo Baba
Written by TK Upperfield
BASP21 DLL
Japanese
Release Notes Sep 11, 2001
BASP21 belongs to Tatsuo Baba
Written by TK Upperfield
This is a comprehensive component, packed with 66 of useful methods, that is able
to operated from ASP, Visual Basic, VBA, WSH(Windows Scripting Host).
Down Load! BASP21-20010911.exe (1002KB)
Update Sep 11, 2001
MD5: 76706c89a1daffaca2d96159a83584ea
How to Install
Download "BASP21.exe" into certain folder and just double-click it.
In next 10-second, installation finishes all work, and shows
confirmation, then just press button to close it.
Following files are copied into System Folder.
- BASP21.DLL Main COM Component
- BSMTP.DLL for SMTP/POP3 Engine
- BREGEXP.DLL for Regular Expression Engine
- BCOUNT.DLL for Counter Engine
- BSENDM.EXE Command Line SendMail Engine
- BINETX.DLL HTTP/FTP Engine
- BASP21.TLB Type Library of BASP21 (Refers from VB or C++)
How to Uninstall
Select BASP21 from [Control Panel] -> [Add/Delete Application]
How to Use
Create object names "basp21" by CreateObject Method.
Set bobj = Server.CreateObject("basp21") ' ASP
Set bobj = CreateObject("basp21") ' VBA or VB
Set bobj = WScript.CreateObject("basp21") ' WSH
Case of
Socket Object:
Set bsocket = Server.CreateObject("basp21.socket") ' ASP
Set bsocket = CreateObject("basp21.socket") ' VBA or VB
Set bsocket = WScript.CreateObject("basp21.socket") ' WSH
Case of
FTP Object:
Set ftp = Server.CreateObject("basp21.FTP") ' ASP
Set ftp = CreateObject("basp21.FTP") ' VBA or VB
Set ftp = WScript.CreateObject("basp21.FTP") ' WSH
Call method of Object you just created.
variable = bobj.method_name(parameter)
If you are using ASP(Active Server Pages), you can create an Application Object by
writing a code into global.asa; looks like below,
SUB Application_OnStart
Set Application("bobj") = Server.CreateObject("Basp21")
END SUB
and declare the object at each asp file as below;
Set bobj = Application("bobj")
List of Methods
- SendMail Send Mail
- SendMailEx Send Mail(Asynchronous Mode)
- RcvMail Receive Mail
- ReadMail Read Mail
- Match String Pattern Match(Perl5 Compatible)
- Replace String Replace(Perl5 Compatible)
- Translate String Translate(Perl5 Compatible)
- Split Split(Perl5 Compatible)
- FGrep File Pattern Match 2000/06/18 Update!
- FileCheck File Check
- Sort Sort
- ReadDir Read(List) Directory
- Space Space
- IsNum Check Digits
- HAN2ZEN Convert double space char to single space char
- RepTagChar Replace HTML Tag
- BinaryRead Read Binary Array from File
- sprintf "sprintf" Wrapper
- strftime "strftime" Wrapper
- Debug Dump strings into Notepad
- StrConv VB Compatible String Converter
- BinaryWrite Write Binary Array into File
- FormSaveAs HTML File Upload(Write File)
- FormFileName HTML File Upload(File Name)
- FormFileSize HTML File Upload(File Size)
- Form HTML File Upload(Read Text)
- FormBinary HTML File Upload(Read Binary)
- Execute Execute Program
- Kconv Convert Kanji Code
- KconvFile Convert Entire File Kanji Code
- BinaryConcat Merge Binary Array
- DebugClear Clear the string of Notepad
- SplitB Split(Perl5 Compatible) Binary Array
- ByteArray Return Binary Array from Strings
- MatchEx Extended Pattern Match
- Counter GIF Counter
- Version Version string
- Base64 BASE64 encode/decode
- Socket Object 6 methods
- FTP Object 12 methods
- GetTempFile Make temporary file2000/01/11 New!
- W3get Get URL(http:// ftp://) 2000/01/11 New!
- MidB Access Binary Array 2000/02/06 New!
- MatchBBinary Array Pattern Match(Perl5 Compatible) 2000/02/06 New!
- SortMail Sort Mail 2000/02/06 New!
- Sleep Sleep 2000/05/20 New!
- MD5 Message Digest 2000/05/20 New!
Explanation of Each Method
- SendMail
Sends mail by SMTP-Protocol. (Sync Mode)
msg = bobj.SendMail(svname,mailto,mailfrom, subj,body,files)
msg [out] : Error message
svname [in] : Name of SMTP Server.
[host.domain/]server[:port[:timeout]]
host.domain - HELO host name and domain name.
server - server name or IP address.
port - port. default is 25.
timeout - timeout (sec). default is 120.
If necessary, locate port number by separating a tab.
mailto [in] : Designate receivers' mail address.
To set multiple mail addresses, separate them with Tab.
Set optional field here, such as cc/bcc/reply-to and other "Mail Header."
mailfrom [in] : Designate sender's mail address.
subj [in] : Designate a subject.
To leave it blank, enter ""(just two double quotes).
body [in] : Designate a body of mail.
To leave it blank, enter ""(just two double quotes).
files [in] : Designate a file name to be attached with full path.
To leave it blank, enter ""(just two double quotes).
To set multiple attached files, separate them with Tab.
Example:
svname = "odyssey" ' Name of SMTP Server
mailto = "BABAQ " ' Receiver's mail address
mailfrom = "somebody " ' Sender's mail address
subj = "Hello w/attached file" ' Mail Subject
body = "Hey, what's up ?" ' Mail Body
files = "g:tempfile1.txt" & chr(9) & "g:tempfile2.txt" ' Attached Files
rc = bobj.SendMail(svname,mailto,mailfrom, subj,body,files)
if rc "" then ' Check Error
rc is the error statement
end if
How to use Mail Header:
If you want to designate cc/bcc/reply-to option field, SendMail/SendMailEx Method can handle them.
To do so, you have to set cc/bcc/reply-to option field in mailto parameter of SendMail Object, by separating each field with tab.
For further optional field, put ">" in head of each entry.
Examples:
> Case 1: Receiver = id1, CC = id2, Message-ID = 12345
mailto = "id1" & vbtab & "cc" & vbtab & "id2" & vbtab & ">Message-ID: 12345"
> Case 2: Receiver = id1 and id2, CC = id3
mailto = "id1" & vbtab & "id2" & vbtab & "cc" & vbtab & "id2"
> Case 3: Receiver = id1 and id2, CC = id3 and id4
mailto = "id1" & vbtab & "id2" & vbtab & "cc" & vbtab & "id3"
& vbtab & "id4"
> Case 4: Receiver = id1, BCC = id2
mailto = "id1" & vbtab & "bcc" & vbtab & "id2"
> Case 5: Receiver = id1, CC = id2, BCC = id3
mailto = "id1" & vbtab & vbtab & "cc" & vbtab & "id2"
& vbtab & "bcc" & vbtab & "id3"
> Case 6: Receiver = id1, Reply-To = id2 (not sender but return address)
mailto = "id1" & vbtab & "reply-to" & vbtab & "id2"
> Case 7: CC = id2
mailto = "cc" & vbtab & "id2"
> Case 8: BCC = id2
mailto = "bcc" & vbtab & "id2"
> Case 9: Hide all receivers, except only representative mail address.
mailto = "common id" & vbtab & "bcc" & vbtab & "id1" & vbtab & "id2" vbtab & "id3"
Enhancing option:
- Representative address name
"@to-header"
The head is used and the mail address of "@" is used only for the TO header.
Therefore, names other than the mail address can be used.
Use this with bcc or cc.
Example: mailto = "@BASP21-ML-User" & vbTab & "bcc" & vbTab & "who@hoge.com"
The TO header is as follows.
To: BASP21-ML-User
- Forwarding mode
">#xfr file-name"
The specified file is forwarded. The file specifies the file made by the RcvMail method.
Former To header is deleted.
Subject is overwrited.
The text and the attached file specified for a parameter are disregarded.
The following header is deleted:
X-Mailer:
X-Mail-Agent:
Status:
To:
Return-Path:
Delivered-To:
example : mailto = "who@hoge.com" & vbTab & ">#xfr c:mailb21xxx.tmp"
mailto = "@ML-user" & vbTab & ">#xfr c:mailb21xxx.tmp"
& vbTab & "bcc" & vbTab & "who@hoge.com"
- Header deletion at forwarding mode
">#d"
To delete the header of the forwarded mail, this offers the finger.
example : mailto = "@ML-user" & vbTab & ">#xfr c:mailb21xxx.tmp"
& vbTab & ">#dcc:"
& vbTab & "bcc" & vbTab & "who@hoge.com"
- Bcc file input mode
">#bcc file-name"
The mail address is input from the file line by line and mail is transmitted.
The transmission address is processed as Bcc not transmitted as a header.
Specify only mail ID for the mail address.
example : mailto = "@ML-user" & vbTab & ">#xfr c:mailb21xxx.tmp"
& vbTab & ">#bcc c:maimailto.txt"
Content of bcc file:
# comment The line of "#" is disregarded as a comment.
who@hoge.com
who1@hoge.com
who2@hoge.com
You have to use SJIS code, if using Kanji code. You don't have to worry about
double-space character to convert single-space character, because BASP Component would
take care of it, instead. When entering more than one filed at receiver's address or
several mail headers or attached file, don't forget to separate them with char(9) (means
an ASCII code of Tab). When SendMail Method is called, the process keeps waiting
until SendMail Method will done its job. To avoid this matter, use SendMailEx
Method, which works as an independent process.
- SendMailEx
Basically same function as SendMail Method, but works on different process from
original process. The result will be saved in log file.
msg = bobj.SendMailEx(logname,svname,mailto,mailfrom,
subj,body,files)
msg [out] : Error message
logname [in] : File name for result log. Full path is required.
svname [in] : Name of SMTP Server.
If
necessary, locate port number by separating a tab.
mailto [in] : Designate receivers' mail address.
To
set multiple mail addresses, separate them with Tab.
Set
optional field here, such as cc/bcc/reply-to and other "Mail Haeder."
mailfrom [in] : Designate sender's mail address.
subj [in] : Designate a subject.
To leave it
blank, enter ""(just two double quotes).
body [in] : Designate a body of mail.
To leave it
blank, enter ""(just two double quotes).
files [in] : Designate a file name to be attached with full path.
To leave it
blank, enter ""(just two double quotes).
To set
multiple attached files, separate them with Tab.
Example:
logname = "g:tempmaillog.txt" ' Name full path of log file
svname = "odyssey" ' Name of SMTP Server
mailto = "BABAQ " ' Reciever's mail address
mailfrom = "somebody " ' Sender's mail
address
subj = "Hello w/attached file" ' Mail Subject
body = "Hey, what's up ?" ' Mail Body
files = "g:tempfile1.txt" & chr(9) & "g:tempfile2.txt" '
Attached Files
rc = bobj.SendMailEx(logname,svname,mailto,mailfrom, _
subj,body,files)
if rc "" then ' Check Error
rc is the error statement
end if
- RcvMail
Receive mail with POP3 Protocol, and save them into a file. To retrieve the mail,
which saved in file, use ReadMail Method.
output = bobj.RcvMail(svname,user,pass,command,dirname)
svname [in] : Name of POP3 Server
If necessary, locate port number by separating a tab.
user [in] : User name of MailBox
pass [in] : Passwd of MailBox
2000/05/20 APOP supported
To use APOP, one blank is applied to "a" or "A" ahead of the password.
"a " & "xxxx" : If the server does not support APOP,
usual USER/PASS will be processed.
"A " & "xxxx" : APOP is compelled. USER/PASS will not be used.
command [in] : Designate command
STAT ...... Returns how many mails are stored in mail server and its total byte size.
LIST [n[-n2]] .. Returns an array of Subject, From, and Date fields, and each field are separated by tab.
To set the range, parameter will be n-n2,
where retrieving from #n mail to #n2 mail.
If n2 is omitted, it returns only #n mail.
If both n and n2 are omitted, it returns all(or first 256th) mail.
SAVE n[-n2] .... Receives #n mail, and does not delete from mail server.
To set the range, parameter will be n-n2,
where retrieving from #n mail to #n2 mail.
If n2 is omitted, it returns only #n mail.
SAVD n[-n2] ... Receives #n mail, and delete from Mail Server.
To set the range, parameter will be n-n2,
where retrieving from #n mail to #n2 mail.
If n2 is omitted, it returns only #n mail.
DELE n[-n2] ... Delete #n mail from mail server.
To set the range, parameter will be n-n2,
where retrieving from #n mail to #n2 mail.
If n2 is omitted, it deletes only #n mail.
SAVEALL ... Receives all mails(up to 256 mails), and does not delete from Mail Server.
SAVEALLD .. Receives all mails(up to 256 mails), and delete from Mail Server.
dirname [in] : Directory(folder) name where received mails would be saved.
output [out] : Returns the result in an array. It won't return anything if error occurred.
The content of array is depended by what command was executed; see below.
STAT - Number of mails stored in mail server and its total byte size
Example: output(0) -> 2 4011
LIST - An array of list which contains Subject、From、and Date fields.
Example:
output(0) -> Subject: HellotFrom: xxxx@xxxx.xxxtDate: 1998/09/15 11:11:30
output(1) -> Subject: Hello2tFrom: xxxx@xxxx.xxxtDate: 1998/09/15 12:11:30
SAVE/SAVD/SAVEALL/SAVEALLD - Returns a file name of where received mails are saved.
DELE - The number deleted mail.
Example:
svname = "odyssey" ' Name of POP3Server
user = "who" ' User name of MailBox
pass = "alibaba" ' Passwd of MailBox
dirname = "c:mailbasp21" ' Directory name to save received mail
outarray = bobj.RcvMail(svname,user,pass,"SAVE 1-10",dirname)
if IsArray(outarray) then ' OK ?
for each file in outarray
array2 = bobj.ReadMail(file,"subject:from:date:",dirname)
if IsArray(array2) then ' OK ?
for each data in array2
Response.Write Server.HTMLEncode(data)
next
endif
next
end if
- ReadMail
Read mail which already received by RcvMail Method.
output = bobj.ReadMail(file,para,dirname)
file [in] : File name with full path.
para [in] : Select the header to retrieve. If omitted, all headers are retrieved.
To avoid saving attached file, enter "nofile:".
Example: subject:from:date:
dirname [in] : Directory(folder) name where received mails would be saved.
output [out] : Returns an array of mail contents.
Each contents are listed in order of "header, body, attached file".
It won't return anything if error occurred.
Example: output(0) -> To: xxxx@xxxx.xxx
output(1) -> From: who@who.com
output(2) -> Date: 1998/09/15 12:30:31
output(3) -> .....
output(4) -> Body: Mail Body
output(5) -> File: File Name1
output(6) -> File: File Name2
Example:
outarray = bobj.ReadMail(file,"subject:from:date:",dirname)
if IsArray(outarray) then ' OK ?
for each data in outarray
Response.Write Server.HTMLEncode(data)
next
end if
- Match
Perl5 Compatible pattern matching method
match = bobj.Match(regstr,target)
match [out] : Returns the result of pattern match.
0 Did not Match
1 Matched
Strings String itself, if MetaChar() was used.
regstr [in] : Regular expression string. First char must be "/" or"m".
target [in] : Target string
Example:
input = "abc1234defgい"
output = bobj.Match("/d{4}/",input) ' Returns 1
output = bobj.Match("/(d{4})/",input) ' Returns 1234
- Replace
Perl5 Compatible String Replace Method
outstr = bobj.Replace(regstr,target)
outstr [out] : Returns the result string
regstr [in] : Regular expression string. First char must be "s".
target [in] : Target string
Example:
' enclose all the numbers with
input="123"
output = bobj.Replace("s/([0-9])//g",input) '
' enclose numbers in each 3 column with
input="1234567891234"
output = bobj.Replace("s/(d{3})//g",input) ' 4
' Take out the comment from source code written in C (means /* ... */)
input="a=1; /* this is comment */"
output=bobj.Replace("s#/*[^*]**+([^/*][^*]**+)*/##g",input) ' a=1;
- Translate
Perl5 Compatible String Conversion Method
outcnt = bobj.Translate(regstr,target,result)
outcnt [out] : Returns the number of count conversion proceeded
regstr [in] : Regular expression string. First char must be "tr".
target [in] : Target string
result [out] : Returns the result string
Examples:
count = bobj.Translate("tr/0-9/0-9/k",input,output)
- Split
Perl5 Compatible Split Method
result = bobj.Split(regstr,target[,limit])
result [out] : Returns the result array of string
regstr [in] : Regular expression string. First char must be "/" or"m".
target [in] : Target string
limit [in] : Limit of the array size. Default is 0(e.g. no limit)
Examples:
outarray = bobj.Split("/s+/i",input,10)
- FGrep
Searches for all lines in a given list of files which contains one or more specified
pattern.
the text file with regular expression and matched with. Each result stored in an
array of string lines, and it returns an array as an output.
rarray = bobj.FGrep(fname,regstr,limit[,opt])
rarray [out] : Returns an array of string line including CR/LF code.
It won't return anything if error occurred or not match.
regstr [in] : Regular expression string. First char must be "/" or"m".
if "" , grep all lines.
fname [in] : Target file name with full path.
limit [in] : Limit of the array size to store the result. Must be more than 1.
opt [in] : option.
1 - reverse
2 - line number
Example:
rc = bobj.FGrep("g:exec.txt","/sql/i",10)
rc = bobj.FGrep("g:exec.txt","/sql/i",10,2) ' line number
rc = bobj.FGrep("g:exec.txt","",10,1) ' reverse
rc = bobj.FGrep("g:exec.txt","/babaq/",10,1+2) ' reverse + line number
if IsArray(rc) then ' Check array
- FileCheck
Returns file size, if exists.
fsize = bobj.FileCheck(fname)
fsize [out] :
>=0 : File exists, if fsize more than equals to 0.
-1 : File does not exist, if fsize equals -1
-2 : It is a Directory or Folder, if fsize equals -2
fname [in] : Target file name with full path.
- Sort
Sort the array. It is also optionally available that the comparative
position and string length.
stime = bobj.Sort(sarray,asdes,soffset,slengh)
stime [out] : Returns the time proceeded.
If stime was -1 then some parameter error occurred.
sarray[in,out] : Target array to be sorted. Result will be returned in same
array.
asdes [in] : 0 Ascending sorting 1 Descending
sorting
soffset [in] : The offset value of the comparative position in string
line.
slength [in] : String length. If 0 then all string line becomes
target.
- ReadDir
Read directory and returns an array of file name.
farray = bobj.ReadDir(dirname & option)
dirname [in] : Enter the directory name with full path.
option [in] : Option. The option is specified next to " :"
s - sort
S - descending sort
t - sort by file update date
T - The file name with the update of the file is returned
D - The directory name is not returned
farray [out] : Returns an array of file name and directory name.
example:
dir = "c:data*.*"
option = " :St"
farray = bobj.ReadDir(dir & option)
option = " :stT"
farray = bobj.ReadDir(dir & option)
- Space
Returns a space character code of SJIS(e.g. X'8140'). This is useful to
enter a space in HTML.
sp = bobj.Space()
sp [out] : Space character code
- IsNum
Check the strings is Numeric or not.
rc = bobj.IsNum(str)
rc [out] : 0 Not-Numeric 1 Numeric
sstr [in] : Target string
- HAN2ZEN
Converts a single-space Kata-Kana into double-space Kata-Kana. It corresponds to
the voiced sound(Decoration character ).
strout = bobj.HAN2ZEN(str)
strout [out] : Returns the converted string.
str [in] : Strings to be converted.
- RepTagChar
Replace the tag for HTML expression.
outstr = bobj.RepTagChar(instr)
outstr [out] : Returns the converted string.
instr [in] : Strings to be converted.
- BinaryRead
Read file and returns a binary array of 1 byte.
barray = bobj.BinaryRead(fname)
barray [out] : Returns a binary array
fname [in] : Enter a file name with full path
Example in ASP:
barray = bobj.BinaryRead("g:h.jpg")
Response.BinaryWrite barray
- sprintf
sprintf - Wrapper Method of C Function
str = bobj.sprintf(format,val)
str [out] : Returns the result of string line.
format [in] : Format Declaration.
val [in] : The numerical value and/or string line.
Examples: str = bobj.sprintf("timestamp is %10d",123)
- strftime
strftime - Wrapper Method of C Function
str = bobj.strftime(fstr)
str [out] : Returns the result of string line.
fstr [in] : Format Declaration.
Examples: TimeStamp = bobj.strftime("timestamp is %Y/%m/%d %X")
- Debug
Dump the message that designated to notepad. Notepad must been opened previously.
If notepad is not opened, nothing appear. In the case use
it with ASP, the notepad will be executed on the machine where IIS is working.
Be careful that target is not the client machine.
bobj.Debug(str)
str [in] : Enter the message or strings to dump in notepad
Examples: bobj.Debug(barray)
bobj.Debug(Array(a,b,c)))
- StrConv
The same function as the StrConv function of Visual Basic. This is the precious
method that is not supported in VBScript.
outstr = bobj.StrConv(instr,type)
outstr [out] : Returns the result of string.
instr [in] : Target string to be converted.
type [in] : Set the type of conversion. Combination
available.
1: Convert to the capital letter of alphabet.
2: Convert to the small letter of alphabet.
3: Convert first character to capital letter
4: Convert all single-space characters(1 byte) to double-space characters(2 byte).
8: Convert all double-space characters(2 byte) to single-space characters(1 byte).
16:Convert from HiraGana to KataKana
32:Convert from KataKana to HiraGana
Examples: outstr = bobj.StrConv(instr,1) ' capital letter of alphabet.
outstr = bobj.StrConv(instr,2+4) ' the small letter and double-space characters
- BinaryWrite
Write an array of 1 byte into the file. This is useful when saving an image data
into a file.
wlen = bobj.BinaryWrite(barray,fname[,mode])
wlen [out] : Returns the number of bytes write out.
less than 0 is eorror
-1 : given array is not 1 byte
-3 : file create error
-4 : file save error
barray [in] : an array of 1 byte
fname [in] : File name with full path
mode [in] : Over write, 0 = New file(default), 1 = Append
Example in ASP:
wlen = bobj.BinaryWrite(barray,"g:h2.jpg")
wlen = bobj.BinaryWrite(barray,"g:h2.jpg",1) ' Append
- FormSaveAs
Save the content into a file that uploaded with HTML
Form(ENCTYPE="multipart/form-data")
Example is here.
wlen = bobj.FormSaveAs(barray,name,fpath)
wlen [out] : Returns the number of bytes write out.
less than 0 is eorror
-1 : given array is not 1 byte
-2 : no name in form
-3 : file create error
-4 : file save error
barray [in] : Contents of the entire form that read by Request.BinaryRead Method.
name [in] : Enter the name which used in tag.
fpath [in] : File name with full path.
Example in ASP:
a=Request.TotalBytes
barray=Request.BinaryRead(a)
wlen = bobj.FormSaveAs(barray,"Filedata","g:h3.jpg")
- FormFileName
Returns the file name that file uploaded with HTML
Form(ENCTYPE="multipart/form-data")
filename = bobj.FormFileName(barray,name)
filename [out] : Returns a file name that appeared in TYPE=FILE tag.
barray [in] : Contents of the entire form that read by Request.BinaryRead Method.
name [in] : Enter the name which used in tag.
Example in ASP:
filename = bobj.FormFileName(barray,"Filedata")
- FormFileSize
Returns the file size that uploaded with HTML
Form(ENCTYPE="multipart/form-data")
filesize = bobj.FormFileSize(barray,name)
filesize [out] : Returns a file name that appeared in TYPE=FILE tag.
barray [in] : Contents of the entire form that read by Request.BinaryRead Method.
name [in] : Enter the name which used in tag.
Example in ASP:
filesize = bobj.FormFileSize(barray,"Filedata")
- Form
Returns a text content that registered in HTML
Form(ENCTYPE="multipart/form-data")
str = bobj.Form(barray,name)
str [out] : Returns a text where stored in tag.
If more than few tags are used, each contents are separated by tab.
barray [in] : Contents of the entire form that read by Request.BinaryRead Method.
name [in] : Enter the name which used in tag.
Example in ASP:
yname = bobj.Form(barray,"yourname")
- FormBinary
Returns a binary array of 1 byte that entered for HTML
Form(ENCTYPE="multipart/form-data"). This is useful when write into
database.
sarray = bobj.FormBinary(barray,name)
sarray [out] : Returns a binary array where stored in tag.
barray [in] : Contents of the entire form that read by Request.BinaryRead Method.
name [in] : Enter the name which used in tag.
Example in ASP:
sarray = bobj.FormBinary(barray,"file1")
- Execute
Executes an independent program and receives a standard output.
rc = bobj.Execute(command,mode,stdout)
command [in] : The program name and its parameter(s).
mode [in] : Set mode or time in msec.
0 - Executes a program and don't wait until it will finish.
1 - Executes a program and wait until it will finish.
Receives an standard output as strings.
2 - Executes a program and wait until it will finish.
Receives an standard output as binary.
more than 3 - Enter a time in msec.
Executes a program and wait until time expires.
Receives an standard output, if executed program finished before then time expires.
To receive a string output, set Odd number for the time length.
To receive a binary output, set Even number for the time length.
If you want to use time out for an independent program, try this mode.
stdout [out] : Returns the standard output.
rc [out] : Returns the result in number.
0 - Normal completion
-1 - Command error. Check the program name and location..
-2 - Time out occured.
Example:
rc = bobj.Execute("net view",1,stdout)
You must use cmd.exe, if you have to execute not Win32 program.
rc = bobj.Execute("cmd.exe /c c:lha.exe l basp21.lzh",1,stdout) ' Windows NT
rc = bobj.Execute("command.com /c c:lha.exe l basp21.lzh",1,stdout) ' Windows 95
- Kconv
Converts the string written by certain Kanji code to designated Kanji code. If
cannot determine the Kanji code of source string, it would be automatically
recognized.
out = bobj.Kconv(instr,outtype[,intype])
instr [in] : Strings to be converted(in case of UNICODE), or byte array.
outtype [in] : Enter the Kanji code to be converted.
0 - Don't convert but returns the type of Kaji code in a number.
1 - SHIFT JIS
2 - EUC
3 - JIS
4 - UNICODE UCS2
5 - UNICODE UTF8
intype [in] : If available, enter the correct Kanji code by a number listed below.
0 - Unknown(default). Auto Recognition.
1 - SHIFT JIS
2 - EUC
3 - JIS
4 - UNICODE UCS2
5 - UNICODE UTF8
out [out] : Returns the converted strings(in case of UNICODE), or a byte array.
If outtype = 0 then it returns the number of Kanji type.
Example:
jisarray = bobj.Kconv("馬場",3) ' Convert from UNICODE UCS2 to JIS
outcode = bobj.Kconv(jisarray,4) ' Convert from JIS to UNICODE UCS2
Caution: Conversion might fail to recognize correct Kanji code, in following case;
- File is written in SHIFT JIS and single-space of Kana characters
- File contains very short Kanji sentence only.
- File is written in UNICODE UTF8
- KconvFile
Converts the file written by certain Kanji code to designated Kanji code. If
cannot determine the existing file's Kanji code, it would be automatically
recognized.
rc = bobj.KconvFile(infile,outfile,outtype[,intype])
infile [in] : File name to be converted.
outfile [in] : File name that written after conversion
outtype [in] : Enter the Kanji code to be converted.
0 - Don't convert but returns the type of Kaji code in a number.
1 - SHIFT JIS
2 - EUC
3 - JIS
4 - UNICODE UCS2
5 - UNICODE UTF8
intype [in] : If available, enter the correct Kanji code by a number listed below.
0 - Unknown(default). Auto Recognition.
1 - SHIFT JIS
2 - EUC
3 - JIS
4 - UNICODE UCS2
5 - UNICODE UTF8
rc [out] : Returns the size of the file after conversion.
If outtype = 0 then it returns the number of Kanji type.
If outtype Caution: Conversion might fail to recognize correct Kanji code, in following case;
- File is written in SHIFT JIS and single-space of Kana characters
- File contains very short Kanji sentence only.
- File is written in UNICODE UTF8
- BinaryConcat
Merges the byte arraies.
outarray = bobj.BinaryConcat(inarray1,inarray2)
inarray1 [in] : 1st merging array.
inarray2 [in] : 2nd merging array.
outarray [out] : Merged byte array.
Example:
outarray = bobj.BinaryConcat(array1,array2)
- DebugClear
Clears the notepad window.
bobj.DebugClear
Example:
bobj.DebugClear
- SplitB
Perl5 Compatible Split procedure for Byte array. Able to handle null code.
result = bobj.SplitB(regstr,barray[,limit])
result [out] : Result in an array of binary array.
regstr [in] : Regular expression string. First char must be "/" or"m".
barray [in] : Target binary array.
limit [in] : Max number of arrays used for result. Default is 0, means no limit.
Example:
outarray = bobj.SplitB("/rnrn/",input,2)
- ByteArray
Returns byte array from string
result = bobj.ByteArray(instr[,type])
result [out] : Result of byte array
instr [in] : String
type [in] : Select ype (0 - 3)
0 - Expect SJIS byte array for output(default)
1 - Assume HexCode string as an input
2 - Expect unicode byte array for output
Example:
outarray = bobj.ByteArray("000102",1) ' X'000102'
- MacthEx
Extended Pattern Match
matcharray = bobj.MatchEx(regstr,target[,mode])
regstr [in] : Regurar expression string. First character must "/" or "m"
target [in] : Target string
mode [in] : Select mode (0 or 1)
0 - Group Match (default)
1 - Entire Match
matcharray [out] : Returns result in array
Group Match:
out(0) : Matched string itself
out(1) : First part of matched string
out(2) : Last part of matched string
out(3) : 1st Group string
out(4) : 2nd Group string
out(n) : Nth Group string
Entire Match:
out(0) : Matched 1sth String
out(1) : Matched 2nd String
out(2) : Matched 3rd String
out(n) : Matched Nth String
Example:
marray=Bobj.MatchEx("//ik",b,1) ' Take out all Tag from HTML
- Counter
Returns binary array of GIF Counter Image. This Counter is based on Count
Release2.3 (Muhammad A Muquit) but arranged to perform as multithread from original.
It is implemented in BCOUNT.DLL. There are 8 types of image(dd = a - h) and
all images are included in dll as an image resource.
barray = bobj.Counter(para,ctr)
para [in] : Parameter of Counter. Same as Count Release 2.3
ctr [in] : Amount of Counter
barray [out] : Binary Array of Counter Image
Example:
========================= ctr.html start ===============
BASP21 Counter Testing
========================= ctr.html end ===============
========================= ctr.asp start ===============
0 then
Application.Lock()
file=Server.MapPath ("/dir1") & "" & ctrname & ".txt"
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
On error resume next
Set inx = FileObject.OpenTextFile(file)
Count = inx.ReadLine
inx.Close
Count = Count + 1
Set outx = FileObject.CreateTextFile(file,True)
outx.WriteLine Count
outx.Close
Application.UnLock()
end if
Response.Expires=0
Response.Buffer=TRUE
Response.Clear
Response.ContentType ="image/gif"
Response.BinaryWrite bobj.Counter(p,Count)
Response.End
%>
========================= ctr.asp end ===============
- Version
Return the version string.
ver = bobj.Version()
ver [out] : Version string.(Mmm DD YYYY)。examples:Oct 16 1999。
Example:
ver = bobj.Version()
- Base64
BASE64 encoder/decoder.
outstr = bobj.Base64(instr[,mode])
instr [in] : Character string before converts.
mode [in] : The conversion mode is specified by the figure as follows.
0 - default. BASE64 encodes data passed in instr.
1 - BASE64 decodes data passed in instr.
2 - ISO-2022-JP + BASE64 encodes data passed in instr.
3 - ISO-2022-JP + BASE64 decodes data passed in instr.
4 - URI encode.
5 - URI decode.
6 - BASE64 encodes between files.
The input file name and the output file name are delimited
in the tab and specified for the character string.
example: c:datainput.jpg [TAB] c:base64output.txt
7 - BASE64 decodes between files.
The input file name and the output file name are delimited
in the tab and specified for the character string.
example: c:base64input.txt [TAB] c:dataoutput.jpg
outstr [out] : the result string.
Example;
outstr = bobj.Base64("user:pass")
outstr = bobj.Base64(para,1)
bobj.Base64 "c:datainput.jpg" & vbTab "c:base64output.txt",6
- GetTempFile
The temporary file name is returned.
When the BASP21 object terminates, the made file is automatically deleted.
tempfile = bobj.GetTempFile([dir])
dir [in] : Directory name by which file is made.
Default is directory set in TMP or TEMP environment variable.
tempfile [out] : Made file name.
example:
temp1 = bobj.GetTempFile()
temp2 = bobj.GetTempFile("c:temp")
Attention:
It is not possible to specify the file name for the attached file of the SendMailEx method.
- W3get
The target file of specified URL is preserved in the file.
HTTP and the FTP protocol are supported.
rc = bobj.W3get(para)
para [in] : The parameter is specified as follows:
-i input-file : The parameter is input from the file.
-l log-file : log file name.
-d output-directory : output directory.
-o output-file : output file.
-j Japanese-character-code : Character-code conversion
sjis : SJIS
euc : EUC
jis : JIS
ucs2 : UNICODE UCS-2
utf8 : UNICODE UTF-8
-t timeout : time-out value. Default is 120 sec.
-p proxy : HTTP proxy server name.
-A user:pass : HTTP "Authorization: Basic" header.
-P user:pass : HTTP "Proxy-Authorization: Basic" header.
-h level : HTTP header only mode.
1: save file. 2: log file. 3: both.
-u user-agent : HTTP User-Agent header. Default is Binetx/1.0.
-f "firewall-arg" : FTP firewall parameter.
"fhost fuser/fpass SITE"
"fhost fuser/fpass"
"fhost"
"fhost OPEN"
-a : FTP ASCII mode
-s : FTP PASV mode
url : URL http:// or ftp://. Specify URL at the end of the parameter.
rc [out] : The made number of files is returned.
example:
' The file is preserved in the specified directory.
rc = bobj.W3get("-d c:temp http://www.yahoo.co.jp/index.html")
' save to temprary file by SJIS code
temp1 = bobj.GetTempFile()
rc = bobj.W3get("-o " & temp1 & " -j sjis http://www.yahoo.co.jp/index.html")
' ftp
rc = bobj.W3get("-d c:temp -j sjis ftp://user:pass@who.com/dir/*.html")
' parameter input
rc = bobj.W3get("-d c:temp -i c:url.txt")
Content of c:url.txt :
-j sjis http://www.yahoo.co.jp/index.html
-a -d e:ftp -j sjis ftp://user:pass@who.com/dir/*.html
http://www.yahoo.co.jp/index.html
- MidB
Byte array is taken out by the offset and the number of bytes.
outarray = bobj.MidB(inarray,offset[,len])
inarray [in] : Byte Array
offset [in] : The beginning taking out position is specified.
When the minus is specified, takes out by relativity
from a right edge.
len [in] : The number of bytes taken out is specified.
The default value is taken out to the last minute by 0.
outarray [out] : The result is returned by Byte Array.
example:
outarray = bobj.MidB(b,128) ' The remainder by which 128 bytes are skipped from head
outarray = bobj.MidB(b,-128) ' The last 128 byte data
outarray = bobj.MidB(b,128,256) ' 256 bytes by which 128 bytes are skipped from head
- MatchB
Perl5 Compatible pattern matching method for Byte Array.
offset = bobj.MatchB(regstr,barray)
regstr [in] : Regular expression string.
barray [in] : target Byte Array.
offset [out] : Returns the offset value.
0 Did not Match
1 or More : Matched relative position + 1
-1 : pattern error.
example:
offset = bobj.MatchB("/d{4}/",barray) ' four digits
offset = bobj.MatchB("/^gif89a/i",bobj.MidB(barray,0,6)) ' gif89a
- SortMail
The received mail can be sorted in each directory, be selected, and deleted.
The sorting result returns the file name by the array.
The path name is not included in the returned file name.
outArray = bobj.SortMail(dir,header[,option][,filter][,delete])
dir [in] : Directory name of mail file.
header [in] : Header name to be sorted.
Specify "" in case of selection and deletion.
The generic name character can be used.
example:
"From:" - From Header
"Date:" - Date header
"Subject:" - Subject Header
"X-Mail*" - X-Mailer or X-Mail-Agent header
option [in] : Options. Default is 0.
0 - ascending sort
1 - descending sort
2 - ignore case
filter [in] : Filter option.
The filter is specified by
Trackback URL for this entry: http://www.watcorp.com/trackback.php?id=20051128113345462
No trackback comments for this entry.
|