' createTagString.vbs ret = GetCharCode select case ret case 0: sCharCode = "SJIS" case 1: sCharCode = "JIS" case 2: sCharCode = "EUC" case 3: sCharCode = "UNICODE" case 4: sCharCode = "UTF-8" case 5: sCharCode = "UTF-7" case 6: sCharCode = "UNICODE-BE" end select
Function getCharCodeStr( charCode ) if Not isNumeric(charCode) then Exit Function aryChar = Array("SJIS", "JIS", "EUC", "UNICODE", "UTF-8", "UTF-7", "UNICODE-BE") getCharCodeStr = aryChar( charCode ) End Function
' Class 定義 Class clsSakuraIni Dim aryLine Private Sub Class_Initialize ' Initialize イベントを設定します。 Dim objFso Dim iniFileName Dim objFs
Set objFso = CreateObject("Scripting.FileSystemObject") iniFileName = getSakuraIniFileName
Set objFs = objFso.OpenTextFile( iniFileName, 1 ) aryLine = Split( objFs.ReadAll, vbCrLf ) objFs.Close Set objFs = Nothing Set objFso = Nothing End Sub
Private Sub Class_Terminate ' Terminate イベントを設定します。 ' Do Nothing End Sub
' ini ファイル名生成 Private Function getSakuraIniFileName() Dim sakuraPath, pos, sRet sakuraPath = ExpandParameter("$S") pos = instrrev(sakuraPath, ".") if pos <= 0 then sRet = "" Else sRet = Mid(sakuraPath, 1, pos ) & "ini" End If getSakuraIniFileName = sRet End Function
' ini ファイルの読み込み Function getProfileString( strSection, strEntry) Dim i, sRet
if UBound( aryLine ) > 0 then ' ini ファイルの解析 Dim bFound,sLine,aryEntity
sRet = "" 'Empty bFound = False For i = 0 to Ubound( aryLine )-1 if bFound then if Left( aryLine( i ), 1 ) = "[" then Exit For
sLine = LTrim( aryLine( i ) ) if Left( sLine, Len(strEntry)) = strEntry then aryEntity = Split( sLine, "=" ) if Trim(aryEntity(0)) = strEntry then if Ubound( aryEntity ) = 1 then sRet = Trim( aryEntity( 1 ) ) Exit For end if end if end if End if if aryLine(i) = "[" & strSection & "]" then bFound = True end if Next Else sRet = "" End If getProfileString = sRet End Function