Tools for generating non-animated BCI images in batches

Source: Internet
Author: User

Tools for generating non-animated BCI images in batches

Abstract:

A batch processing tool for converting BMP to BCI. Set the environment variable of the brew_authtool program path before use.

'Usage:
'Drag the folder containing BMP to the script file for execution.
'The generated BCI file will be placed in the BCI/subdirectory of this folder.

'Make sure that the BMP folder contains no disc/and BCI/subdirectories before execution.
'

Double-click the script to obtain help information.

Body:

 

 

Script File Content
'Bci Single chart automatically generated. vbs

'Convert the BMP file in the specified folder to a BCI file.
'
'Usage:
'Drag the folder containing BMP to the script file for execution.
'The generated BCI file will be placed in the BCI/subdirectory of this folder.
'
'Note:
'Before use, you need to set the environment variable of the brew_authtool path.
'Make sure that the BMP folder contains no disc/and BCI/subdirectories before execution.
'
'2006/10/24
'By D. H.


'-------------------------------------------------
'App name
App_name = "BREW-BCI Single chart batch generation tool"

 

'-------------------------------------------------
'Brew BCI authoringtool path
Brew_bci_tool = "brew_authtool.com"


'---------------------------
'Init Shell
Set wshshell = Createobject ("wscript. Shell ")

 

'---------------------------
'Filesystem init
Dim FS
Set FS = Createobject ("scripting. FileSystemObject ")
Const forreading = 1, forwriting = 2, forappending = 8

 

'---------------------------
'Access arguments
Set ARGs = wscript. Arguments
If args. Count> 0 then
Parentdir = ARGs (0 )&"/"
Else
Usage = "drag the BMP folder to the script file. "& Vbcr
Usage = Usage & "or command execution: Script Name: BMP folder name" & vbcr
Usage = Usage & "make sure there are no subfolders In the BMP file./disc/;./BCI/" & vbcr
Usage = Usage & "the generated BCI is stored in the subdirectory BCI. "& Vbcr
Usage = Usage & "make sure that the environment variable of the brew_authtool path is set. "
Msgbox usage, vbinformation, app_name
Wscript. Quit
End if

 

'---------------------------
'Path setting
If not fs. folderexists (parentdir) then
Msgbox "BMP Folder does not exist! ", Vbcritical, app_name
Wscript. Quit
End if
Set parentfolder = FS. getfolder (parentdir)

 

'Bci description file directory
Discdir = parentdir & "disc /"
If not fs. folderexists (discdir) then
FS. createfolder (discdir)
End if
Set discfolder = FS. getfolder (discdir)

 

'Bci generated directory
Bcidir = parentdir & "BCI /"
If not fs. folderexists (bcidir) then
FS. createfolder (bcidir)
End if
Set bcifolder = FS. getfolder (bcidir)

 

'------------------------------------
'Create TXT discription File
Set fc = parentfolder. Files
For each srcfile in FC
Fname = getfilename (srcfile. Name)
Fext = getfileex (srcfile. Name)
If lcase (fext) = "BMP" then
Filename = discdir & fname & "." & "TXT"
Set F = FS. createtextfile (filename)
F. writeline (srcfile. Path)
F. Close
End if
Next

 

'---------------------------------------
'Create BCI File
Set fc = discfolder. Files
Filecnt = 0
For each txtfile in FC
Fname = getfilename (txtfile. Name)
Fext = getfileex (txtfile. Name)
'Msgbox brew_bci_tool & "-I" & txtfile. Path & "-o" & bcidir & fname & ". BCI"
Wshshell. Run "% comspec %/C" & brew_bci_tool & "-I" & txtfile. Path & "-o" & bcidir & fname & ". BCI", true
Filecnt = filecnt + 1
Next


'---------------------------------------
'Finishing the work
If fs. folderexists (discdir) then
FS. deletefolder (discfolder. Path)
End if

 

'---------------------------------
'Report result
Report = "finished." & vbcr
Report = Report & "Generation:" & filecnt & "BCI files. "& Vbcr
Report = Report & "put in:" + bcidir
Msgbox report, vbinformation, app_name

 

 

 

 

'****************************
'Function getfilename
'
Function getfilename (filename)
Getfilename = left (filename, limit Rev (filename, ".")-1)
End Function

 

'****************************
'Function getfileex
'
Function getfileex (filename)
Getfileex = right (filename, Len (filename)-limit Rev (filename ,"."))
End Function

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.