Source Insight 中自定义命令的实现

来源:互联网 发布:黄金直播软件 编辑:程序博客网 时间:2024/05/23 19:15

我们开发过程中需要频繁的打开 ref_list.txt,可以通过 Source Insight 中的定制命令功能很方便的实现相应的命令和快捷键:

把要执行的工具文件放到一个目录下,比如:E:/tools

 

菜单:Options à Custom Commands

(1)       添加新命令

 点击 Add 按钮,输入命令名称,比如“open_txt

 Run 输入框中写入命令:E:; cd E:/tools; open_txt.bat  %j

   命令注释:切换到E:切换当前目录到E:/tools; 执行open_txt.bat%j为当前工程目录

(2)         把命令加入菜单

 点击Menu按钮,Command列表中选中上一步添加的命令

 Menu下拉框中选中 Work菜单

 点击Insert按钮

                     这样菜单栏就出现了Work à open_txt 菜单项

(3)       添加快捷键

 Options à Custom Commands窗口中,点击Keys按钮

 Command列表中选中第(1)步添加的命令

 点击Assign New Key 按钮,按F10键(也可指定其它键)

这样在Source Insight中按F10就可以执行定制的命令open_txt

 

open_txt.bat内容:

perl open_txt.pl %0 %1

 

open_txt.pl内容:

#!/usr/local/bin/perl

 

#$prog_name = $ARGV[0];

$proj_dir =  $ARGV[1];

 

$ref_list_path = "plutommi//Customer//CustResource//PLUTO_MMI";

$ref_list_name = "ref_list.txt";

 

chdir($proj_dir);

 

if(-e "MCU")

{

       chdir("MCU");

}

 

chdir($ref_list_path);

 

system("Uedit32.exe $ref_list_name");

原创粉丝点击