2012年8月11日土曜日

サクラエディタ用Grep結果処理マクロ


サクラエディタのGrep結果を基に各種の処理をするために作成しました。
実行するにはサクラエディタ用Grep結果取得マクロが必要です
--------------------------------------------------------------------------------
Const ERR_FORMAT = 1
Function main(ByRef objStrategy)
    '開始処理
    If objStrategy.execStartProc() = False Then
        Exit Function
    End If
    'Grepしたフォルダのパスを取得
    Dim strFolderPath: strFolderPath = getFolderPath()
    If strFolderPath = "" Then
        'フォルダのパスが取得できない場合はフォーマットエラー
        Call objStrategy.execErrProc(ERR_FORMAT)
        Exit Function
    End If
    'Grepの結果を全て取得
    Dim objGrepResults: objGrepResults = getGrepResults()
    Call Editor.FileClose()
    '前処理
    If objStrategy.execPreProc(objGrepResults) = False Then
        Exit Function
    End If
    Dim objGrepResult
    For Each objGrepResult In objGrepResults
        '本処理
        If objStrategy.execProc(objGrepResult) = False Then
            Exit For
        End If
    Next
    '後処理
    If objStrategy.execPostProc(objGrepResults) = False Then
        Exit Function
    End If
    '終了処理
    Call objStrategy.execEndProc()
End Function
--------------------------------------------------------------------------------

0 件のコメント:

コメントを投稿