1.自定义命名设置界面(Tool -> Custom Commands...)

Command

显示当前选中命令的名字. 下拉列表中包含了所有的自定义命令.

Run

命令行,当调用自定义命令时,这个命令行就会被执行. 命令行中可以包含特殊的元字符. 详见 “The 'Run' Field Format”.

Dir

设定命令行执行时的工作目录.
Source Insight 会在命令行执行前将当前工作目录设置为此处设定的值.
如果是空的,那么Source Insight 会将当前工作目录设置为工程源码目录.

Output Group

这组选项控制命令输出.

Iconic Window(窗口显示模式)

启动此项, 命令执行产生的窗口是最小化的,Source InSight仍是当前活动窗口;
不启动此项, 命令执行产生的窗口取代Source InSight成为当前活动窗口.
举例来说,比如命令是打开Windows资源管理器,
启用此项后,Windows资源管理器被打开,但是窗口是最小化的;
不启动此项, Windows资源管理器正常打开,窗口显示Source InSight前面.

Capture Output

启用此项后,当命令执行完成后,命令的标准输入会被捕捉并且显示在一个新的命令输入窗口中,这个窗口的标题是自定义命令的名字.
不启动此项, 不会捕捉标准输出.

Paste Output

启用此项后,命令的标准输出会被粘贴到当前的选择区域.

Control Group

这组选项控制Source Insight在命令执行前后做什么处理

Save Files First

启用此项后,Source Insight 会在命令执行前 执行'Save All'(Ctrl+Shift+S)命令.
'Save All' 命令会提示你每一个被更改的文件来让你确认是否要保存.
不启动此项, 命令执行时不会保存任何改动过的文件. 未保存的‘变化’在命令结束后仍然保留 .
如果命令导致Source Insight崩溃,Source Insight可以恢复,未保存的‘变化’也是完好的.

Pause When Done

启用此项后, 当命令结束后,Source Insight 会在DOS窗口中显示下面的消息:

Press any key to return to Source Insight...

不启动此项, DOS窗口会在命令结束后关闭.

Beep When Done

启用此项后, Source Insight 会在命令结束后发出beep音.

Wait Until Done

启用此项后,Source Insight 会挂起(suspend)直到命令结束.
不启动此项, 你可以切换回Source Insight窗口继续工作,命令会在后台继续执行 .

Exit Source Insight

命令执行后Source Insight 会关闭.

Source Links in Output

你可以使用这些选项来处理命令结束后的输出.
你可以让Source Insight 分析捕捉到的输出,从中找出你指定的内容,例如某些警告或者错误信息.

Parse Source Links

The command output will be searched for source link
patterns. The patterns typically will match warning and error messages.
If a pattern match is found, Source Insight inserts a source link at
that line. The source link is used to link the warning or error message
to its target source line. If Parse Source Links is enabled, you must
have a valid search expression in the Pattern text box.

Pattern contains

File, then Line and Line, then File. This indicates
the order of the groups in the pattern expression.
Select File, then Line if the first group in the pattern
expression is the file name and the second group is the line number.
With this setting, the second group, (i.e. the line number), is optional.
Select Line, then File if the first group in the pattern
expression is the line number and the second group is the file name.

Pattern

Contains the regular expression used to search the command output for file names and line numbers.
如果 Parse Source Links 选项未启用,Source Insight会忽略Pattern;
如果 Parse Source Links 选项启用了,那么Pattern处必须填入一个有限的正则表达式(that contains “groups” for the file name and the line number.

Add

添加一个自定义命令.

Remove

删除当前自定义命令.

Close

退出设定.

Help

查看自定义命令的帮助文档,即本文.

Run

运行当前自定义命令.

Menu

将自定义命令导入Source Insight菜单.

Keys

给当前命令设定快捷键.


2.自定义命令的格式

可以包含多个命令,命令之间使用分号分割, 例如:

cat make.log;echotime

This string causes “cat make.log” to execute, followed by “echotime”.


3.Running the Command Shell

如果你想运行windows的DOS命令, 例如 “type”、 “dir”, 或者你想运行一个批处理文件,
那么你必须使用cmd.exe来运行他们. 请看下面的例子:

cmd /c mybat.bat
cmd /c type foo.txt

Note: 如果你是用的是 Windows 9x/Me, 你应该使用command.com 代替 cmd.exe.

If the Run string contains more than one command, separated by semi-colons, you don’t need to run cmd.exe because Source Insight creates a batch file from the run string commands and runs command.com automatically in that case. For example,

cat readme.txt;dir

This works fine because it is already running in a batch file inside a shell.

You may find that the shell you spawned by cmd.exe does not have enough environment space. If that happens, use the /e switch with cmd.exe. For example,

cmd /e:1024 /c mybat.bat

This allocates 1K bytes of environment space to the new sub shell spawned by command.com.


4.Command Line Substitutions

The Run text box can contain meta-characters that cause
the following items to be substituted in the string.

Table 1: Custom
Command Meta-Characters

Character

Expands to

Example

%f

当前文件的完整路径名 【*】

c:\myproj\file.c

%r

当前文件相对于工程源码目录的相对路径名 【*】

file.c

%n

leaf name of the current file 【*】

file.c

%d

当前文件所在的完整路径名

c:\myproj

%h

当前文件的路径名(无磁盘驱动器字符)

\myproj

%b

当前文件名(无后缀名) 【*】

file

%e

当前文件的后缀名

c (file.c 的文件后缀名为 c)

%c

当前文件所在的磁盘驱动器字符

c: (表示当前文件在磁盘驱动器C:下)

%p

当前项目名称(包含完整路径)

c:\myproj\myproj

%j

当前项目的源码路径

c:\myproj

%J

当前项目的数据路径

C:\Documents and Settings\Jim Smith\My Documents\Source Insight\Projects\Base

%v

当前项目源码所在的磁盘驱动器字符

c:

%o

当前项目的名称(不包含路径)

myproj

%l

当前行号

行号

%w

选择区域的第一个单词,或者光标处的单词

任何单词

%s

自定义命令运行时,保存当前选择的临时文件名.

d:\tmp\vt0004.

%a

当前日期

05-12-02

%t

当前时间

08:23

%1 - %9

提示用户输入参数

any strings

You can also postfix any of the above characters marked
with * with either of the following modifier characters.

Character

Expands to

Example

%o

所有打开的文件

%f%o

%m

所有修改的文件

%f%m


5.ShellExecute 命令

自定义命令支持 “ShellExecute” 函数, 可以通过他告知 Windows shell 去如果操作一个文件.

ShellExecute的一个优点是你不必知道何种应用被注册去处理某种类型的文件.

详细技术资料见Windows Shell API 文档中的 “ShellExecute” .

“ShellExecute” 的使用方法如下:

ShellExecute <verb> <filespec> <optional parameters>

例如使用浏览器打开一个网站:

ShellExecute open https://www.baidu.com

verb 是一个单词, 可以是下列其中一个:

edit 打开一个编辑器来编辑指定的文件.只能是文档文件(document file)

explore 使用资源管理器打开指定的文件夹.

open 打开指定的文件. 文件类型可以是可执行文件、 文档文件(document file) 或者是文件夹.

print 打印指定的文件,如果文件类型不是文档文件(document file),函数会失败.

• properties 显示文件或者文件夹的属性.

find 加载windows的文件查找功能.

"" (空字符串) 跳过此参数.

参数 filespec 可以是任意有效的路径.
如果路径中有空格,使用双引号将路径括起来
你可以使用元字符,例如 %f (当前文件). .

The optional parameters list is anything to the right
of the filespec. It specifies the parameters to be passed to the application
that ultimately runs. The format is determined by the verb that is
to be invoked, and the application that runs. You can use custom command
meta-characters here as well.

The working directory text box of the custom command
is applied before the ShellExecute is invoked. However, output cannot
be captured or parsed when using ShellExecute.


6.ShellExecute 使用例子

下面是几个使用 ShellExecute 的例子.

想要完成的动作

执行命令例子

打开一个网站

ShellExecute open http://www.somewebsite.com

To explore your Windows 2000 documents
file folder:

ShellExecute explore “C:\Documents
and Settings”

To explore your Windows 98 documents
file folder:

ShellExecute explore “C:\My Documents”

打开浏览器

ShellExecute “” iexplore

在IE浏览器中预览一个文件

ShellExecute “” iexplore %f

在当前项目目录搜索文件

ShellExecute find %j


7.后台运行自定义命令

When Source Insight spawns a Custom Command shell program,
it actually runs a program called Sihook3.exe.

Sihook3.exe in turn
spawns the command and performs the output capturing.

You can run a
custom command and click back on the Source Insight window to continue
editing with Source Insight while the custom command runs in the background.

SourceInSight自定义命令说明与应用的更多相关文章

  1. node生成自定义命令(yargs/commander)

    第一部分可以生成一个自定义命令,例如常见的”express”,yargs和commander则可以在生成的自定义命令上做扩展,yargs将命令扩展成类似express --l xx的形式;而comma ...

  2. laravel 自定义命令

    1.自定义命令:将自定义命令保存在app/Console/Commands,也可以在composer.json文件配置自动加载,自由选择想要放置的地方 php artisan make:console ...

  3. Linux自定义命令

    linux自定义命令,就是给当前命令取个别名.比如:ls 列出当前的文件,rm + 文件名 就能删除该文件,如何自定义命令,可以使用alias比如:alias gobin='cd /opt/tomca ...

  4. cmd alias 自定义命令

    简短步骤:1.关闭所有在运行的CMD窗口2.创建文件C:\cmd-alias.bat,包含以下内容:[python] view plain copydoskey sayhello=echo Hello ...

  5. WPF自定义命令和处发命令

    接实现ICommand接口的命令.在介绍之前,先看一下ICommand接口的原型: event EventHandler CanExecuteChanged; bool CanExecute(obje ...

  6. Linux 创建自定义命令

    Linux 创建自定义命令 Linux 可以创建自定义使用命令 这里我们采取使用“alias”命令.这里我们首先了解两个文件,通过这两个文件我们可以根据环境配置相应的自定义命令. 该文件内创建的自定义 ...

  7. linux_shell自定义命令

    一.命令可执行文件所在目录 shell命令可执行文件所在目录是保存在环境变量PATH中的,终端输入如下命令查看 PATH 环境变量的内容: $ echo $PATH 我的linux输出如下: /opt ...

  8. Mac 命令行,自定义命令

    例如自定义命令 gotoXFolder, 直接进入XFolder文件夹, XFolder地址为~/abc/def/Xfolder 步骤: 1. 在home文件夹下创建.profile文件 在.prof ...

  9. u-boot-1.1.6实现自定义命令

    学习目标: 1.了解u-boot-1.1.6中命令的实现机制 2.掌握如何在u-boot-1.1.6中添加自定义命令 1.命令的实现机制 uboot运行在命令行解析模式时,在串口终端输入uboot命令 ...

随机推荐

  1. mac下安装android-sdk

    安装sdk brew cask install android-sdk 配置Path环境 vim ~/.bash_profile 设置路径 #Setting PATH for android-sdk ...

  2. python模拟页面调度LRU算法

    所谓LRU算法,是指在发生缺页并且没有空闲主存块时,把最近最少使用的页面换出主存块,腾出地方来调入新页面. 问题描述:一进程获得n个主存块的使用权,对于给定的进程访问页面次序,问当采用LRU算法时,输 ...

  3. 从Random Walk谈到Bacterial foraging optimization algorithm(BFOA),再谈到Ramdom Walk Graph Segmentation图分割算法

    1. 从细菌的趋化性谈起 0x1:物质化学浓度梯度 类似于概率分布中概率密度的概念.在溶液中存在不同的浓度区域. 如放一颗糖在水盆里,糖慢慢溶于水,糖附近的水含糖量比远离糖的水含糖量要高,也就是糖附近 ...

  4. LeetCode-两数之和

    Question 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个整数,并返回他们的数组下标. 你可以假设每种输入只会对应一个答案.但是,你不能重复利用这 ...

  5. JAVA中循环删除list中元素的方法总结【转】

    印象中循环删除list中的元素使用for循环的方式是有问题的,但是可以使用增强的for循环,然后今天在使用时发现报错了,然后去科普了一下,再然后发现这是一个误区.下面就来讲一讲..伸手党可直接跳至文末 ...

  6. css中自定义字体

    css代码如下: @font-face { font-family: 'HelveticaNeueLTPro-Th'; src: url('../fonts/HelveticaNeueLTPro-Th ...

  7. C++数组的初始化

    来源:https://zhidao.baidu.com/question/380723280.html int a[]={1,2,3}; 这种方式初始化,大括号里写了几个元素那么数组里就有几个元素,相 ...

  8. shell拼写检查,利用Linux字典

    rename #find path -type  f -name "*.mp3" -exec mv { } target_dir \; #mp3 file mv dir_file ...

  9. [精品书单]3D打印机课程设计

    3D打印机整个绘图过程........... 三维图 工程图 编程

  10. iOS 单选框

    iOS 单选框,可自定义横向和纵向显示,可定义显示的个数和内容,自定义间距,提供block 和代理方法可供使用,欢迎拍砖! github地址: https://github.com/joshuaGen ...