批量產生非動畫bci圖片的工具

來源:互聯網
上載者:User

 批量產生非動畫bci圖片的工具

摘要:

BMP轉換成BCI的批量處理工具。使用前設定一下BREW_AuthTool程式路徑的環境變數。

' 用法:
' 將包含BMP的檔案夾托拽到該指令檔上執行。
' 產生的bci檔案將放在該檔案夾的bci/子目錄中。

' 執行前保證BMP檔案夾中沒有 disc/ 和 bci/ 2個子目錄。
'

雙擊指令碼可獲得協助資訊

本文:

 

 

指令檔內容
' BCI單圖自動產生.vbs

' 將指定檔案夾中的bmp檔案轉換為bci檔案。
'
' 用法:
' 將包含BMP的檔案夾托拽到該指令檔上執行。
' 產生的bci檔案將放在該檔案夾的bci/子目錄中。
'
' 注意:
' 使用前需要設定一下BREW_AuthTool路徑的環境變數。
' 執行前保證BMP檔案夾中沒有 disc/ 和 bci/ 2個子目錄。
'
' 2006/10/24
' by D.H.


'-------------------------------------------------
' APP NAME
APP_NAME = "BREW-BCI單圖批量產生工具"

 

'-------------------------------------------------
' 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 = "將bmp檔案夾托拽到該指令檔上。" & vbCr
 usage = usage & "或者命令執行:指令碼名 bmp檔案夾名字" & vbCr & vbCr
 usage = usage & "確保BMP檔案中沒有子檔案夾 ./disc/;./bci/ " & vbCr
 usage = usage & "產生的bci存放的子目錄 bci/ 中。" & vbCr & vbCr
 usage = usage & "確保設定了BREW_AuthTool路徑的環境變數。"
 MsgBox usage, vbInformation, APP_NAME
 WScript.Quit
End If

 

'---------------------------
' path Setting
If not fs.FolderExists( parentDir ) Then
 MsgBox "BMP檔案夾不存在!", vbCritical, APP_NAME
 WScript.Quit
End If
Set parentFolder = fs.GetFolder( parentDir )

 

' bci描述檔案目錄
discDir = parentDir & "disc/"
If not fs.FolderExists( discDir ) Then
 fs.createFolder( discDir )
End If
Set discFolder = fs.GetFolder( discDir )

 

' bci組建目錄
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


'---------------------------------------
' 收尾工作
If fs.FolderExists( discDir ) Then
 fs.DeleteFolder( discFolder.path )
End If

 

'---------------------------------
' REPORT result
report = "Finished." & vbCr
report = report & "產生: " & fileCnt & " 個bci檔案。" & vbCr
report = report & "放在: " + bciDir
MsgBox report, vbInformation, APP_NAME

 

 

 

 

'****************************
' Function GetFileName
'
Function GetFileName( filename )
    GetFileName = Left( filename,InStrRev( filename, "." ) - 1 )
End Function

 

'****************************
' Function GetFileEx
'
Function GetFileEx( filename )
    GetFileEx = Right( filename, Len( filename ) - InStrRev( filename, "." ) )
End Function

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.