博客日历
2025年06月 | ||||||
一 | 二 | 三 | 四 | 五 | 六 | 七 |
26 | 27 | 28 | 29 | 30 | 31 | 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
存档
2025年03月 2024年
03月 04月 05月 2021年
01月 02月 11月 12月 2020年
02月 03月 04月 05月 06月 07月
09月 2018年
09月 2017年
01月 02月 07月 2016年
01月 04月 07月 08月 11月 12月
2015年
01月 02月 03月 05月 09月 10月
11月 2014年
01月 02月 03月 04月 05月 06月
07月 08月 09月 10月 11月 12月
2013年
01月 02月 03月 04月 05月 06月
07月 08月 09月 10月 11月 12月
2012年
01月 02月 03月 04月 05月 06月
07月 08月 09月 10月 11月 12月
2011年
01月 02月 03月 04月 05月 06月
07月 08月 09月 10月 11月 12月
2010年
01月 02月 03月 04月 05月 06月
07月 08月 09月 10月 11月 12月
2009年
03月 04月 05月 06月 07月 08月
09月 10月 11月 12月
将AStyle集成到VC++7.1
将AStyle集成到VC++7.1.rar
' * --------------------------------------------------------------------
' * File Name : 将AStyle集成到VC++.vbs
' * Description : NULL
' * Author : 淡月清风
' * Edited : 2009年2月8日21:39:02
Option Explicit
On Error Resume Next
Const DEF_AStyleDirectory = "D:\Program Files\AStyle"
Const DEF_RegPath = "HKCU\Software\Microsoft\VisualStudio\7.1\External Tools\"
'Const DEF_RegPath = "HKCU\Software\Microsoft\VisualStudio\9.0\External Tools\"
'Const DEF_RegPath = "HKCU\Software\Microsoft\VisualStudio\9.0\External Tools\"
Const DEF_MsgBoxTitle = "提示 - 淡月清风"
Dim objFso,objWshShell,ToolNumKeys
Dim IsInstalled
Dim AStyleParameters
AStyleParameters = ""
AStyleParameters = AStyleParameters & " --style=ansi"
AStyleParameters = AStyleParameters & " --mode=c"
AStyleParameters = AStyleParameters & " --force-indent=tab=4" ' -T4
AStyleParameters = AStyleParameters & " --brackets=break" ' -b
AStyleParameters = AStyleParameters & " --indent-cases" ' -K
AStyleParameters = AStyleParameters & " --indent-namespaces" ' -N
AStyleParameters = AStyleParameters & " --indent-preprocessor" ' -w
'AStyleParameters = AStyleParameters & " --break-blocks=all" ' -F
'AStyleParameters = AStyleParameters & " --pad=paren-in" ' -D
AStyleParameters = AStyleParameters & " --pad=oper" ' -p
AStyleParameters = AStyleParameters & " --fill-empty-lines" ' -E
AStyleParameters = AStyleParameters & " --verbose" ' -v
Set objFso=CreateObject("Scripting.FileSystemObject")
If Not objFso.FolderExists(DEF_AStyleDirectory) Then
objFso.CreateFolder(DEF_AStyleDirectory)
End If
If Not objFso.FileExists(DEF_AStyleDirectory & "\AStyle.exe") Then
objFso.CopyFile "AStyle.exe",DEF_AStyleDirectory & "\AStyle.exe"
End If
Set objWshShell = WScript.CreateObject("WScript.Shell")
ToolNumKeys = objWshShell.RegRead(DEF_RegPath & "ToolNumKeys")
'判断当前是否已经安装了AStyle
Dim OrgToolCmd
OrgToolCmd = objWshShell.RegRead(DEF_RegPath & "ToolCmd" & ToolNumKeys-1)
If OrgToolCmd = DEF_AStyleDirectory & "\AStyle.exe" Then
'覆盖
ToolNumKeys = ToolNumKeys - 1
IsInstalled = true
Else
'新增
ToolNumKeys=ToolNumKeys
IsInstalled = false
End If
'1.ToolCmd
Dim ToolCmd,ParamToolCmd
ToolCmd="ToolCmd" & ToolNumKeys
ParamToolCmd=DEF_AStyleDirectory & "\AStyle.exe"
objWshShell.RegWrite DEF_RegPath & ToolCmd,ParamToolCmd,"REG_SZ"
'2.ToolArg
Dim ToolArg,ParamToolArg
ToolArg="ToolArg" & ToolNumKeys
ParamToolArg="$(ItemFileName)$(ItemExt)" & AStyleParameters
objWshShell.RegWrite DEF_RegPath & ToolArg,ParamToolArg,"REG_SZ"
'3.ToolDir
Dim ToolDir,ParamToolDir
ToolDir="ToolDir" & ToolNumKeys
ParamToolDir="$(ItemDir)"
objWshShell.RegWrite DEF_RegPath & ToolDir,ParamToolDir,"REG_SZ"
'4.ToolOpt
Dim ToolOpt,ParamToolOpt
ToolOpt="ToolOpt" & ToolNumKeys
ParamToolOpt=26
objWshShell.RegWrite DEF_RegPath & ToolOpt,ParamToolOpt,"REG_DWORD"
'5.ToolSourceKey
Dim ToolSourceKey,ParamToolSourceKey
ToolSourceKey="ToolSourceKey" & ToolNumKeys
ParamToolSourceKey=""
objWshShell.RegWrite DEF_RegPath & ToolSourceKey,ParamToolSourceKey,"REG_SZ"
'6.ToolTitle
Dim ToolTitle,ParamToolTitle
ToolTitle="ToolTitle" & ToolNumKeys
ParamToolTitle="AStyle 1.22代码格式化(&A)"
objWshShell.RegWrite DEF_RegPath & ToolTitle,ParamToolTitle,"REG_SZ"
'X.写入外部工具计数
objWshShell.RegWrite DEF_RegPath & "ToolNumKeys",ToolNumKeys + 1,"REG_DWORD"
Dim InfoText
If Err.Number = 0 Then
If IsInstalled Then
InfoText="您已经重新安装了AStyle 1.22代码格式化工具!"
Else
InfoText="成功安装了AStyle 1.22代码格式化工具!"
End If
MsgBox InfoText,48,DEF_MsgBoxTitle
Else
MsgBox "发生错误:" & Err.Number,48,DEF_MsgBoxTitle
End If
上一篇: 语法高亮编辑控件Scintilla在MFC中的简单使用之完整示例
下一篇: 甲型H1N1流感(猪流感)防护手册
分类:脚本编程 查看次数:9448 发布时间:2009/5/12 18:28:11