Source Insight 中自定義命令的實現
我們開發過程中需要頻繁的開啟 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
- 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");